![]() |
|
|
#1 |
|
Eligible for custom title
Join Date: Jun 2007
Location: C:\Program Files (x86)\Aphexdreamer\
Posts: 5,614 (2.59/day)
Thanks: 812
Thanked 888 Times in 674 Posts
|
C++ While Loop Won't Loop
Solved
__________________
Sent from my PC using chrome. Last edited by AphexDreamer; Feb 23, 2013 at 04:06 PM. |
|
|
|
|
|
#2 |
![]() Join Date: Jun 2010
Location: Wild Wild East
Posts: 4,572 (4.25/day)
Thanks: 2,332
Thanked 1,337 Times in 916 Posts
|
i think something is wrong with your switch statement.
it seems to be selecting the "Case EXIT " everytime. try using a default case ; HTML Code:
switch (menuSwitch){
case DEPOSITE:
cout<<"Enter the amount of deposit: ";
cin>>amount;
cout<<"Your current balance is: "<<transaction(amount,balance,DEPOSITE)<<endl<<endl;
break;
case WITHDRAW:
cout<<"Enter the amount of withdraw: ";
cin>>amount;
if(amount>balance){
cout<<"*** Insufficient funds."<<"Your current balance is: "<<transaction(amount,balance,WITHDRAW)<<endl<<endl;
}
else cout<<"Your current balance is: "<<transaction(amount,balance,WITHDRAW)<<endl<<endl;
break;
case EXIT:
cout<<"Have a Nice Day."<<endl;
quit=4;
break;
default: cout<<"default";
this way you will know if its having some logical problem there ![]() i just noticed that you dont seem to be taking the input for menuSwitch at the end of each case. also you can run the while loop with menuSwitch by : while(menuSwitch!=0) where "0" corresponds to exit. also menuSwitch is declared an integer, but in the cases you seem to be using it as a string? that would explain your switch error |
|
|
|
|
|
#3 |
|
Banned
Join Date: Jul 2008
Location: Dhaka, Bangladesh
Posts: 280 (0.16/day)
Thanks: 151
Thanked 70 Times in 54 Posts
|
Try removing from the loop:
Code:
return 0; |
|
|
|
| The Following User Says Thank You to syeef For This Useful Post: |
|
|
#4 |
|
Eligible for custom title
Join Date: Jun 2007
Location: C:\Program Files (x86)\Aphexdreamer\
Posts: 5,614 (2.59/day)
Thanks: 812
Thanked 888 Times in 674 Posts
|
__________________
Sent from my PC using chrome. |
|
|
|
|
|
#5 |
![]() |
Just something to keep in mind for next time. When you edit your original post to remove all the info and put in its place "solved", it doesn't do much to help someone having the same issue. People's replies might still help, but it's nice to compare the original problem to one's own.
I'm not doing any programming in C++, I'm just saying it would be better practice to put in bold at the front of the post "Solved" and leave the rest. Either way, 'glad you were able to resolve your issue! |
|
|
|
| The Following User Says Thank You to OnePostWonder For This Useful Post: |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| BSOD while gaming now boot loop | JanJan | General Software | 16 | Feb 6, 2013 09:22 AM |
| Turn a closed loop cooler into a loop? Possible? | TRWOV | Overclocking & Cooling | 11 | Nov 12, 2012 05:38 AM |
| Been out of the computer loop for a while. | JayPeeM | General Hardware | 22 | Aug 22, 2011 05:43 AM |
| been out of the loop for a little while... | ericfx1984 | General Hardware | 1 | Apr 22, 2011 02:59 AM |
| Loop diagram | MaximusExtreme | Overclocking & Cooling | 6 | Jul 11, 2010 05:41 PM |