HELP!

Can someone help me see what's is wrong?

I am trying to run a program to loop and check that the number I entered is:
1) between 0 - 9999
2) does not contain digit 1,2 or 3 (if so, cout a message)
3) does contain digit 1,2, or 3

I have tried to key in the following but unfortunately I couldn't run it.


#include <iostream> //For 'cout' and 'cin'
#include <iomanip> //NEW ONE! for 'toupper' function
using namespace std;

int main()
{
int num,num1,num2, num3, num4;
int dig1, dig2, dig3, dig4;

dig1 = (num%10);
dig2 = (num1%10);
dig3 = (num2%10);
dig4 = (num3%10);

num1 = (num%10);
num2 = (num1%10);
num3 = (num2%10);
num4 = (num3%10);
cout << "Enter the desired number: " << num << endl;
cin >> num;

while

(num >= 0) && (num <= 9999)
{
for ((num < 0 && num >9999))
{
cout << "Invalid, pls re-enter number between 0 and 9999...";
cout << "Enter desired number:";
cin >> num;
}
if
((dig1 >= 1 && dig1 <= 3) || (dig2 >= 1 && dig2 <= 3) || (dig3 >= 1 && dig3 <= 3))
cout << "Enter the desired number" << num << endl;
else if
(dig1 > 3 && dig2 > 3 && dig3 > 3)
cout << "Entered number does not contain the digit 1,2 or 3";
cin >> num;

}


cin.ignore();
cin.ignore();

return 0;


}


Please edit your post and make sure your code is [code]between code tags[/code] so that it has line numbers and syntax highlighting, as well as proper indentation.

You need an extra set of parentheses around your while loop condition. Also, your formatting is horrible - why do you put conditions on their own lines?
Topic archived. No new replies allowed.