I am just trying to draw a simple card to dos console.. I am following this tutorial.. and for some reason, this small program is yielding over 102 compilation errors... compiler doesn't seem to like the #define's but they are written just like the tutorial.
Code:#include<iostream> #include<cstdlib> #include<iomanip> #include<cstring> #include<windows.h> using namespace std; #define WHITE BACKGROUND_RED | \ BACKGROUND_GREEN | \ BACKGROUND_BLUE | \ BACKGROUND_INTENSITY #define RED FOREGROUND_RED | FOREGROUND_INTENSITY #define BLACK 0 typedef struct card { unsigned int face_value; char suit; card *next; card(){next=NULL;} }*mycard; int main(void) { HANDLE hOut; hOut = GetStdHandle(STD_OUTPUT_HANDLE); card new_card = new card; srand(GetTickCount()); new_card->face_value = static_cast<unsigned>rand()%9+2; new_card->suit = static_cast<char>rand()%4+3; SetConsoleTextAttribute(hOut, new_card->suit<2?WHITE|RED:WHITE|BLACK); cout << new_card->face_value << new_card->suit << " \n" << " \n" << " " << new_card->suit << " \n" << " \n" << " " << new_card->suit << new_card->face_value; return 0; }



LinkBack URL
About LinkBacks



