Loops Issue (error checking)

I need to get the break statements on lines 27 and 45 out of my code.I am trying to make this program loop 3 times for a correct pin code and I can get it to work using break. I have to make it work without break, continue, or return statements. Any suggestions?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
  int main()
{
    string name;
    double stowyBalance = 0,
           mildredBalance = 0,
           stowyAtm = 0,
           mildredAtm = 0,
           stowyBalanceReward = 0,
           mildredBalanceReward = 0;
    
   do
   { 
          
   cout << "Please enter your first and last name. or END to exit\n"; ///ASK FOR NAME
   getline (cin, name);
   
   if (name == "Joey Stowy")
   {
            int stowyPin;
            for (int i=0;i<3;i++)
            {
            cout << "Please enter your PIN Joey, or 9 to exit.\n";
            cin >>stowyPin;
            if (stowyPin == 4433)
            stowyBalance = stowyBank(stowyAtm);
            else if (stowyPin == 9)
            break;
            else cout<<"Pls try again!!!\n";
   
            }
            
   }
   
   
   else if (name == "Mildred Moredebt")
   {
            int mildredPin = 0;
            for (int i=0;i<3;i++)
            {
            cout << "Please enter your PIN Mildred, or 9 to exit.\n";
            cin >>mildredPin;
            if (mildredPin == 2849)
            mildredBalance = mildredBank(mildredAtm);
            else if (mildredPin == 9)
            break;
            else cout<<"Pls try again!!!\n";
            }
                            
                  
   }
           
   }while (name != "END"); //loops and error checks until user enters END
   
Replace lines 27 and 45 with:
1
2
 
  i = 4;  // force end of loop 
Great idea... end the loop... Thanks!!

I don't know why I was stuck on that...
Topic archived. No new replies allowed.