Hi, I am a high school student taking C++.
I had to write a program which takes in a number and lists all of the primes less than or equal to that number.
That I did no problem.
Now the teacher would like us to check the input to be sure that it is allowable.
I have read the FAQ and still don't understand how to take in a string (C++ style) and convert it to an int. Could someone help.
Or is that the best way to do it??
cout << "Please enter a positive integer: ( 0 to quit )";
cin >> user_input;
So I need to be sure that the user has entered a positive integer or 0. If 0 then quit. If not a positive int then I need to ask again.
We have not covered pointers yet so I don't know how to use them. Any help or a link to a place that could help would be much appreciated.