Bueno, en todo este tiempo ya logré hacer el programa pero como te indicaba en el primer post, no logro hacer que las cartas salgan seguidas, osea, de izquierda a derecha horizontalmente...
este es el código:
#include <iostream>
#include <cstdlib>
#include <windows.h>
#include <ctime>
using namespace std;
void color(int X);
void gotoxy(unsigned short x,unsigned short y);
enum {BV = 179, ESD = 191, EII, BH = 196, EID = 217, ESI};
enum {COR=3, DIA, TRE, PIC};
void marco(int b, int h, int x, int y);
void PintaCarta(int S, int N);
int main(){
srand(time(NULL));
int Simb=rand()%3+3, Num=rand()%13+1, NumCards, opc;
do{
system("color 0F");
cout<<"Cuantas cartas quieres?"<<endl;
cin>> NumCards;
for(int a=0; a<NumCards; ++a){
Simb=rand()%3+3, Num= rand()%13+1;
PintaCarta(Simb, Num);
Sleep(250);
}
color(7);
gotoxy(1, 25);
cout<<"quieres mas cartas? 1) SI 2) NO "<<endl;
cin>>opc;
system("cls");
}while(opc==1);
system("color 0F");
gotoxy(1, 28);
system("pause");
return 0;
}
void PintaCarta(int S, int N){
int ancho = 15, alto = 16, Px= rand()%65+1, Py=rand()%10+1;
if(S==3 || S==4) color(244);
else color(240);
marco(ancho, alto, Px, Py);
gotoxy(Px+1, Py+2);
cout<<char(S);
gotoxy(Px+13, Py+12);
cout<<char(S);
switch(N){
case 1: gotoxy(Px+1, Py+1);
cout<<"A";
gotoxy(Px+7, Py+7);
cout<<char(S);
gotoxy(Px+13, Py+13);
cout<<"A";
break;
case 10: gotoxy(Px+1, Py+1);
cout<<N;
gotoxy(Px+5, Py+4);
cout<<char(S)<<" "<<char(S);
gotoxy(Px+5, Py+6);
cout<<char(S)<<" "<<char(S);
gotoxy(Px+7, Py+5);
cout<<char(S);
gotoxy(Px+5, Py+8);
cout<<char(S)<<" "<<char(S);
gotoxy(Px+7, Py+9);
cout<<char(S);
gotoxy(Px+5, Py+10);
cout<<char(S)<<" "<<char(S);
gotoxy(Px+12, Py+13);
cout<<N;
break;
case 11: gotoxy(Px+1, Py+1);
cout<<"J";
gotoxy(Px+7, Py+7);
cout<<"J";
gotoxy(Px+13, Py+13);
cout<<"J";
break;
case 12: gotoxy(Px+1, Py+1);
cout<<"Q";
gotoxy(Px+7, Py+7);
cout<<"Q";
gotoxy(Px+13, Py+13);
cout<<"Q";
break;
case 13: gotoxy(Px+1, Py+1);
cout<<"K";
gotoxy(Px+7, Py+7);
cout<<"K";
gotoxy(Px+13, Py+13);
cout<<"K";
break;
default: gotoxy(Px+1, Py+1);
cout<<N;
gotoxy(Px+13, Py+13);
cout<<N;
break;
}
switch(N){
case 2: gotoxy(Px+7, Py+5);
cout<<char(S);
gotoxy(Px+7, Py+9);
cout<<char(S);
break;
case 3: gotoxy(Px+7, Py+5);
cout<<char(S);
gotoxy(Px+7, Py+7);
cout<<char(S);
gotoxy(Px+7, Py+9);
cout<<char(S);
break;
case 4: gotoxy(Px+5, Py+5);
cout<<char(S)<<" "<<char(S);
gotoxy(Px+5, Py+9);
cout<<char(S)<<" "<<char(S);
break;
case 5: gotoxy(Px+5, Py+5);
cout<<char(S)<<" "<<char(S);
gotoxy(Px+7, Py+7);
cout<<char(S);
gotoxy(Px+5, Py+9);
cout<<char(S)<<" "<<char(S);
break;
case 6: gotoxy(Px+5, Py+5);
cout<<char(S)<<" "<<char(S);
gotoxy(Px+5, Py+7);
cout<<char(S)<<" "<<char(S);
gotoxy(Px+5, Py+9);
cout<<char(S)<<" "<<char(S);
break;
case 7: gotoxy(Px+5, Py+5);
cout<<char(S)<<" "<<char(S);
gotoxy(Px+5, Py+7);
cout<<char(S)<<" "<<char(S)<<" "<<char(S);
gotoxy(Px+5, Py+9);
cout<<char(S)<<" "<<char(S);
break;
case 8: gotoxy(Px+5, Py+5);
cout<<char(S)<<" "<<char(S);
gotoxy(Px+7, Py+6);
cout<<char(S);
gotoxy(Px+5, Py+7);
cout<<char(S)<<" "<<char(S);
gotoxy(Px+7, Py+8);
cout<<char(S);
gotoxy(Px+5, Py+9);
cout<<char(S)<<" "<<char(S);
break;
case 9: gotoxy(Px+5, Py+4);
cout<<char(S)<<" "<<char(S);
gotoxy(Px+5, Py+6);
cout<<char(S)<<" "<<char(S);
gotoxy(Px+7, Py+7);
cout<<char(S);
gotoxy(Px+5, Py+8);
cout<<char(S)<<" "<<char(S);
gotoxy(Px+5, Py+10);
cout<<char(S)<<" "<<char(S);
break;
}
}
void marco(int b, int h, int x, int y){
gotoxy(x, y);
cout << (char)ESI;
for(int i=2; i<b; ++i){
cout << (char)BH;
}
cout<<(char)ESD;
gotoxy(x, y+1);
for(int j=2; j<h; ++j){
cout << (char)BV;
for(int i=2; i<b; ++i){
cout << " ";
}
cout << (char)BV;
gotoxy(x, y+j-1);
}
cout << (char)EII;
for(int i=2; i<b; ++i){
cout << (char)BH;
}
cout<<(char)EID;
}
void gotoxy(unsigned short x, unsigned short y)
{
HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);
COORD coord = {x-1,y-1};
SetConsoleCursorPosition(handle,coord);
}
void color(int X)
{
SetConsoleTextAttribute(GetStdHandle (STD_OUTPUT_HANDLE),X);
}
Ahora cambio la pregunta: cómo hago para que las cartas no aparezcan de esa forma si no horizontalmente todas alineadas?, ya le he movido y movido pero no lo logro hacer :s
Pd: debe instararse conio para verse.