NEW UPDATE - I've got the code working now. Check the latest post. Thanks to everyone for your help. I'm sorry to have bothered you with my ignorance -_-'.
Okay, small update...the new code I have is:
Now, this is a working version (one that compiles perfectly fine, that is). Mainly, there are two problems with this one:Code:#include <cstdlib> #include <iostream> using namespace std; int main() { int y = 0; int z = 0; for (int x = 0; x == 1; z++) { cout<< "Enter 0 to exit or 1 to continue."; cin>> y; if (y == 1) { if (x == 0) { x++; } else { return x; } cout<< "You have repeated this process "<< z <<" times. \n"; } else { return 0; } } cin.get(); }
It doesn't display the line I want displayed (Enter 0 to exit it 1 to continue) and terminates no matter what I enter,
and it exits no matter what I enter as a value.
So, my questions would really be:
1. What's causing the program to not display my line of text defined at cout<< ?
2. If those compiler errors were fixed, would the resulting program run like I want it to?
(and, if the answer to 2 is a no, and you're feeling generous: Why wouldn't it?)
I know I might be asking a lot...but I have fiddled with this for over 4 hours and I'm getting really, really stressed here -_-'.
Thank you so much for all your help!
P.S.: in case anyone's wondering...I added the 'return 0' on the 'else' statement because I thought returning 0 to 'main' would end the program...was that just a totally stupid thought?