I am new to C and this is my code.
#include<stdio.h>
void printCard(char name, char symbol);
int main()
{
printCard('J','*');
printCard('K','&');
}
void printCard(char name, char symbol)
{
printf("-------------\n");
printf("| %c |\n",name);
printf("| %c |\n",symbol);
printf("| |\n");
printf("| |\n");
printf("| |\n");
printf("| %c |\n",symbol);
printf("| %c |\n",name);
printf("-------------\n");
}
This is the output that I am getting.
Is there a way to get that second card to appear beside the first? Thanks
This was the function that worked for me.
void gotoXY(int x, int y)
{
COORD coord;
coord.X = x;
coord.Y = y;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coord);
}
Thanks @PCLuddite for pointing me to check setConsoleCursorPosition which helped me find this above function online. Hope this helps others.