|
-
Nov 3rd, 2004, 11:24 AM
#1
Thread Starter
Fanatic Member
background color!!!
hi
Well I am new to C++ and I know little about C++ .All that I see
is "a DOS window" Is there any small and simple program that I play with..
for example ,lets first generate a random number and if number =10 let the
background color of our page becomes green..
This way I will get an idea of how C++ works...or any suggestion??
thanks
-
Nov 3rd, 2004, 12:09 PM
#2
Graphics is usualy not what you start with when it comes to C++ because C++ it self doesn't contain any GUI libs. You have to use external libs or API calls or what ever, and then you should know a bit about C++ first. Try to make some hello world apps, read up on about random numbers, and make more functions, then some classes, and stuff. Read the tutorials CornedBee have been so nice to write for us. And if you like it, then buy a book.
-
Nov 3rd, 2004, 01:34 PM
#3
Re: background color!!!
Originally posted by merhaba
Well I am new to C++ and I know little about C++ .All that I see
is "a DOS window" Is there any small and simple program that I play with..
for example ,lets first generate a random number and if number =10 let the
background color of our page becomes green..
This way I will get an idea of how C++ works...or any suggestion??
thanks
It depends on what graphics interface you want to use. If you want to change the background color of a console window, then you have to color each line and it can get messy. I don't believe that would even color the entire window.
Do you want to make an empty window with a color in it that changes? Do you want to change the background of a console program? Do you want to change the background color of a program you're working on? if so, what GUI are you using?
We need more information to help you out but I agree with the suggestion already made. If you don't know much of C++, do the non-GUI stuff first and buy a book. Reading the tutorials here is also a good start.
-
Nov 4th, 2004, 02:26 PM
#4
PowerPoster
GUI "Graphics User Interface"
Definitly is not the best place for you to start you new found task of tutoring yourself through C++.
I would start with like suggested a hello app like, this one is a bit beefed up, I just wrote it now and tested it...so it should work.
#include <iostream.h>
PHP Code:
int main()
{
bool bRunning = true;
int Choice = 0;
while (bRunning)
{
cout << "*******************" << endl;
cout << "*Choice 1: (Hello)*" << endl;
cout << "*Choice 2: (Exit) *" << endl;
cout << "*******************" << endl << endl;
cout << "Enter your choice: ";
cin >> Choice;
cout << endl << endl;
if (Choice <= 0 || Choice > 2) cout << "Invalid Selection!" << endl;
else if (Choice == 1) cout << "HELLO WORLD COMPLEX!!!!" << endl << endl << endl;
else if (Choice == 2) bRunning = false;
}
cout << "Good-Bye!" << endl;
return 0;
}
Understand that, and then continue.
"From what was there, and was meant to be, but not of that was faded away." - - Steve Damm
"The polar opposite of nothingness is existance. When existance calls apon nothingness it shall return to nothingness." - - Steve Damm
"When you do things right, people won't be sure if you did anything at all." - - God from Futurama
-
Nov 4th, 2004, 08:59 PM
#5
Software Eng.
Familiarize yourself with the Set/GetConsoleTextAttribute for colour changes in the console.
-
Nov 4th, 2004, 09:01 PM
#6
Software Eng.
Originally posted by Megatron
Familiarize yourself with the Set/GetConsoleTextAttribute for colour changes in the console.
The others are right though; familiarize yourself with the language, itself, before anything fancy.
-
Nov 6th, 2004, 01:02 AM
#7
Originally posted by Halsafar
#include <iostream.h>
Remember, in the C++ standard, the .h is gone and it should be just <iostream>. <iostream.h> will still work but isn't standard. Also, including <iostream> guarentees all functions, types, ect in iostream will be included but may not come from just iostream.h. Where as iostream.h may or may not include all functions, types, ect that iostream should have.
I'm not sure how well I explained that one. Maybe I can find a decent article about it.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|