Just starting out and trying to figure out where I am doing this wrong, takes more than 2 seconds to compile, what am I doing wrong, just starting out and messing around with the while loop. Thanks.
#include <iostream>
usingnamespace std;
int main()
{
int num;
int total;
int counter = 1;
int enter;
cout << "How many times do you want to play?\n"
<< "Enter Number Here: ";
cin >> num;
total= num;
cout << "You want to play to " << total <<" times.";
while (counter <= total){
cout << "\nEnter the Number one.\n";
cin >> enter;
++counter;
}
}
ha ha. does the code look ok, I am curious if I missing anything, have the variable enter seems kind of odd, I was wondering if there was a better way to do it.
#include <iostream>
usingnamespace std;
int main()
{
int total;
int counter = 1;
int enter;
cout << "How many times do you want to play?\n" << "Enter Number Here: ";
cin >> total;
cout << "You want to play to " << total << " times.";
while (counter <= total)
{
cout << "\nEnter the Number one.\n";
cin >> enter;
++counter;
}
return 0;
}
awesome, that is what I was looking for, I don't know what I want either :0) just trying to figure out the logic and make sure I am writing the cleanest I can, and I see what you are saying, why make something equal to another variable when its not going to change, DOH. thank you.
Nothing is wrong you could add "stdafx.h" but I don't know if your IDE would allow it stdafx is a precompiled header thing which will make it so the compiler doesn't have to start from scratch and re compile everything.