Ok now i am having a retarded issue im sure. but here is what is supose to happen is n is not allowed to be more than 5 but when i run this and enter in 5 i get a blank space and when i enter 1-4 i get the error meassage. For reasons beyond me i can't figure it out.

void problem8(){
unsigned seed = time(0);
    srand(seed);
    int num1=rand()%90+10;
    int num2=rand()%90+10;
    int n=0;//choice

    cout<<"Choice 1: addition, 2: subtraction, 3: multiplication, 4: division, 5: to end\n";
    cin>>n;
    while(n<=5){
       cout<<"Choice 1 for addition, 2 for subtraction, 3 for multiplication, 4 for division, 5 for ending the program\n"; 
       cin>>n;
    }
    ...
  }

could you post the details of those error message

judging from the code you posted there shoudn't be any error regarding input

If you want to restrict input to integers in [1, 5], your while condition should be different.

One way to do it is by using two relational operators and the logical OR operator.

Read your condition while(n<=5) cout error out loud and listen/think about what you're saying. Does that condition do what you want?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.