🔒 Closed ATM c++ using switch and loop

Status
Not open for further replies.

Lenardkun

Fanatic
Patulong po kung pano gumawa ng ATM c++ using switch and loop. Groupings po kasi to kaso ala pong gustong maki group sakin. kaya dito nalang po ako nag ask ng help. sana po matulungan nyo po ako. Willing po ako matuto kahit medyo slow learner po ako
 
andito palang po ako, nakalimutan kona po susunod sa tagal ng alang pasok :(
 

Attachments

  • 1603607582368971925727.webp
    1603607582368971925727.webp
    412.8 KB · Views: 24
Use while loop for the attempts then inside the loop use else if statements.
Ganito ang condition sa while loop:

C++:
while (count != 0) {
    
    // insert enter pin here

    if () {
        
        // insert ATM functions here
        
    } else {
        
        // insert remaining attempts here, (count - 1)
        
    } 
    count--;
}

 
may tanong lang po ako, kapag natapos na ko yung transactions pano ko po maibabalik ulit dun sa menu ano po gagamitin ko?
 
pano po gawin yun? sorry po talaga

C++:
int option; // this will hold the input value for the options

while (count == 0) {
   
    // enter pin number here
   
    if (pinNumber == pass) {
       
        while (true) {
           
            // insert ATM menu here

            
           // here if the user enter 0 this will exit the program.
           if (option == 0) {
           
            return 0;
       
           // if the user enter 1 this will do some ATM functions | see example below
           } else if (option == 1) {
           
           } else if (option == 2) {
            // more ATM functions
           }
       
          // and so on ...
           
        }
       
    }
   
}



Your program will only exit if the user chooses the option for exit.
 
Dapat may else ka na mag hahandle ng ibang input so pag hindi nag input yung user ng integer mag lalabas ng error yung else statement.
 
sir last na tanong na po. hindi ko po talaga maayos yung error dun sa withdraw and deposit. kapag naglagay ko ng Letters nag error yung program hindi na makaalis sa withdraw or deposit. pano ko kaya to maayos? eto nalang po problem dun sa code
 
Status
Not open for further replies.

About this Thread

  • 19
    Replies
  • 772
    Views
  • 4
    Participants
Last reply from:
Lenardkun

Trending Topics

Online now

Members online
433
Guests online
1,236
Total visitors
1,669

Forum statistics

Threads
2,274,142
Posts
28,953,861
Members
1,235,099
Latest member
hiro1985
Back
Top