Hello. I am taking a beginning C++ class and the teacher is terrible (really. I'm not just saying that.) He wants us to write programs based on material we have not covered. Anyway, I am having trouble with an assignment. I am supposed to write a program that prints out the prime numbers between and including 1 and 239. I have written a small program, but I am getting error messages. Any help would be great!
You haven't defined bool prime(int n) and your for loop does nothing (get rid of that trailing semi-colon.) Also, get rid of the semi-colon here: setw(3); <<
Don't forget to add braces where needed (for loop, if-control structures).
*edit* of course control structures can work without braces, it's just that the OP can prevent silly mistakes like some of the ones he/she made if he/she actually used braces like the rest of the world does.
No, it works with out braces, it's just that you can't have a statement inside another statement both without braces.
Also, don't add a semi-colon; after your for loop.