Ask your own question, for FREE!
Mathematics 23 Online
OpenStudy (bahrom7893):

Guys I need C++ help again..

OpenStudy (bahrom7893):

This is so weird, I can do the hard problems easily and I can't do the basic stuff..

OpenStudy (bahrom7893):

Anyway I'm trying to do this.. I want my program to accept anything right, but if they are not the following numbers: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 I want the program to say try again.

OpenStudy (bahrom7893):

#include<iostream> using namespace std; int main() { int month; cout << "Please enter a month (1-12): "; cin >> month; while (month != 1 || month != 2 || month != 3 || month != 4 || month != 5 || month != 6 || month != 7 || month != 8 || month != 9 || month != 10 || month != 11 || month != 12) { cout << "An incorrect month has been entered, try again: "; cin >> month; break; } if (month == 1 || month == 2 || month == 3 || month == 4 || month == 5 || month == 6 || month == 7 || month == 8 || month == 9 || month == 10 || month == 11 || month == 12) cout << "A correct month has been entered."; system("pause"); return 0; } I'm trying to do this, but it's not doing what I want it to do..

OpenStudy (bahrom7893):

something like that.. can anyone fix it?

OpenStudy (bahrom7893):

ah forget it, i misread the assignment..

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!