trying to get out of loop + start a new display

i'm stuck in while loop, i tried doing break; but errors. I have a bunch of while loops because the user has to input 5 scores. If it's not valid, it'll ask for it again.

anyway, i stop at assign_2 and I have to start a new thing, but it just goes back to the top.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

    //************************
    //************INPUT assignment 2
    
    
    cout << "Please enter score for Assignment 2: ";
    cin >> assign_2;
    
    
    while(assign_2<0||assign_2>100){
  cout << "Exam score cannot be lower than 0.0 or higher than 100.0. Please re-enter assignment 2: ";
        cin>>assign_2;
       
    
}
    //this isn't showing
    cout << "hey";
return 0 ;
}


could it also be because of

1
2
3
4
5
6

    //Display Enter Student name
    
    cout << "Please enter student's name (First Last): ";
    getline(cin,student);
    cout << endl;

the getline?
Last edited on
Looking at this it looks like your brackets are weird not only that but you gave us a very small snippet of the program.
do i have to post all of it i mean my school does that whole anti-plagiarism spiel
could it also be because of the getline?
Maybe. But without seeing the sequence in which things occur, it's hard to say.

do i have to post all of it
No, what you need to post is sufficient code so that someone else can run the code and reproduce the same problem. By all means edit and trim your code before posting - but make sure that it still demonstrates the problem.
ok i changed OS' from Mac (Xcode) to visual studio and it solved my problems. I don't know what's wrong with xcode because something weird called "thread 1.1" always shows up and messes up my work. I googled the problem, but it always seems to come back. My code is fine, it's just the compiler, I guess.
Topic archived. No new replies allowed.