Charas-Project
Off-Topic => Really Old Stuff => Archive => General programming => Topic started by: maxine on October 28, 2005, 07:07:34 PM
-
Ok school test in computer programming is coming up. I know for sure a question will be "Show an example how to use a while loop".. So i will put up a simple math test with a while loop, and perhaps someone can find any compiling error in it.
//While loop
#include
using namespace std;
int main()
{
double answer1;
do{
cout << "what is 5 + 5: " ;
cin >> answer1;
if (answer1 == 10){
cout << " " << endl;
cout << "Its correct" << endl;
//Here its supposed to go too question number 2 etc.
}
else{
cout << " " << endl;
cout << "Wrong go to the beginning" << endl;
cout << " " < }
}while (answer1 <10 || answer1 >10);
cin.ignore(1000,'\n');
getchar();
return 0;
}
i make the cout << " " << endl; to make new rows, thats just my way of doing it. And i would like too know if some1 dosent get it too work. My DEVCPP is currently not available for me since i am not at that computer and i wont be untill after the test. So i would aprreciate if some1 tested this or see anything wrong right here =). The program is supposed to say"Correct" if you put the right answer and go to the beginning if you are wrong.
Cheers*
-
I don't see anything wrong about it. Looks good.
-
pheeew thank you for that. Now lets see what the test answers say ;)
-
C++ in school? Cool.
-
Originally posted by Moosetroop11
C++ in school? Cool.
What, you've never been?
Its great. I actually had a C++ Introductory class, and then an advanced C++ class, then an "Independant Study" class (play around on the computer). That teacher ROCKED :D
-
Originally posted by Moosetroop11
C++ in school? Cool.
Yeah it owns so damn hard. But we only have A and B course.
But you know c++ moosetroop dont you?