Hey, i'm in the final stage of a course who has c++ programming to learn, i gotta do an empty project on win32 console application(it doesn't necessarily need to be that i think,i'm just mentioning cause it's what i'm used to work on,and btw the only thing we have here to work on is microsoft visual c++ 6.0 if that helps on anything at all) with everything we learned(i mean code based,not literally as everything as every single project we did),i have some knowledge on #include<stdio.h>, #include<conio.h>, #include<stdlib.h>, #include<string.h>(to be more specific,printf,scanf,if/else,switch,getch,while,do while,size of,etc(the basics of c++)). As i typed on the title,i'm outta original ideas on what to do on the project and i'll be grateful to hear any kind of suggestion. P.S.: I'm a newb as probably anyone well aknowledged on the subject can see by the way i typed this and hoping you don't give a to much complex suggestion if possible even though i'll still be willing to hear cause it might help me snap to a good idea. P.S.S.: 1 question,how do i change background/text color,i did my research on some commands and don't seem to work or i'm doing it wrong,i think it's simply they don't work on this version of visual c++ but just wondering the code if you can help. Thank you for reading at the very least.
for ideas check this one http://www.sourcecodesworld.com/source/LanguageHome.asp?LangId=1 for text color one way is this Code: #include <windows.h> #include <iostream.h> int main(){ SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 5); //color=5 cout << "Your text here" << endl; getchar(); return 0; }
Thanks for the help dude i think the link is gonna help by what i could see from it,didn't use the code you gave me yet but i bet it'll work but i was just wondering if you knew another way to change the background/text color without the use of iostream. btw i suppose the background is SetConsoleBackgroundAttribute? I'm a complete newbie just saying out loud,anyways a thanks. -clicks thanks box- Thank you for your time and caring
Code: #include <windows.h> #include <stdio.h> #define BLACK 0 #define BLUE 1 #define GREEN 2 #define CYAN 3 #define RED 4 #define MAGENTA 5 #define BROWN 6 #define LIGHTGREY 7 #define DARKGREY 8 #define LIGHTBLUE 9 #define LIGHTGREEN 10 #define LIGHTCYAN 11 #define LIGHTRED 12 #define LIGHTMAGENTA 13 #define YELLOW 14 #define WHITE 15 #define BLINK 128 int main(){ SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), _rotl(RED,4) | GREEN); printf("Your text here"); getchar(); return 0; } without iostream,for background and foreground color