techPowerUp! Forums

Go Back   techPowerUp! Forums > Software > Programming & Webmastering

Reply
 
Thread Tools
Old Feb 23, 2013, 07:00 AM   #1
AphexDreamer
Eligible for custom title
 
AphexDreamer's Avatar
 
Join Date: Jun 2007
Location: C:\Program Files (x86)\Aphexdreamer\
Posts: 5,614 (2.59/day)
Thanks: 812
Thanked 888 Times in 674 Posts

System Specs

C++ While Loop Won't Loop

Solved
__________________
Sent from my PC using chrome.

Last edited by AphexDreamer; Feb 23, 2013 at 04:06 PM.
AphexDreamer is online now  
Reply With Quote
Old Feb 23, 2013, 07:17 AM   #2
de.das.dude
3500 Posts
 
de.das.dude's Avatar
 
Join Date: Jun 2010
Location: Wild Wild East
Posts: 4,572 (4.25/day)
Thanks: 2,332
Thanked 1,337 Times in 916 Posts
Send a message via Skype™ to de.das.dude

System Specs

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
__________________
my wallet isnt hashwell compatiple *sad face*
de.das.dude is online now  
Reply With Quote
Old Feb 23, 2013, 07:18 AM   #3
syeef
Banned
 
Join Date: Jul 2008
Location: Dhaka, Bangladesh
Posts: 280 (0.16/day)
Thanks: 151
Thanked 70 Times in 54 Posts

System Specs

Try removing from the loop:
Code:
return 0;
syeef is offline  
Reply With Quote
The Following User Says Thank You to syeef For This Useful Post:
Old Feb 23, 2013, 07:19 AM   #4
AphexDreamer
Eligible for custom title
 
AphexDreamer's Avatar
 
Join Date: Jun 2007
Location: C:\Program Files (x86)\Aphexdreamer\
Posts: 5,614 (2.59/day)
Thanks: 812
Thanked 888 Times in 674 Posts

System Specs

Quote:
Originally Posted by syeef View Post
Try removing from the loop:
Code:
return 0;
lol thanks.
__________________
Sent from my PC using chrome.
AphexDreamer is online now  
Reply With Quote
Old Feb 23, 2013, 07:13 PM   #5
OnePostWonder
200 Posts
 
Join Date: Dec 2008
Posts: 486 (0.30/day)
Thanks: 61
Thanked 90 Times in 71 Posts

System Specs

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!
OnePostWonder is offline  
Reply With Quote
The Following User Says Thank You to OnePostWonder For This Useful Post:
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

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


All times are GMT. The time now is 04:41 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
no new posts