GIDForums  

Go Back   GIDForums > Computer Programming Forums > C++ Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 02-Apr-2007, 21:31
rbroller815 rbroller815 is offline
New Member
 
Join Date: Apr 2007
Posts: 11
rbroller815 is on a distinguished road

need help looping this


CPP / C++ / C Code:
double getA ()
{

	int A
	
	
	cout<<" Please enter the A coefficient ";
	cin>>A;

	if (A==0)
	cout<<" Please enter another value that is non-zero";
	cin>>A;
	else 
	return A;
	
	
}

Thats the function i am working on i know its wrong but i need help doing the loop it needs to take in A and then it needs to c if it is zero and if it is then return an error then call for another answer till it is right. help thank you.
Last edited by admin : 03-Apr-2007 at 00:37. Reason: Please insert your C code between [cpp] & [/cpp] tags
  #2  
Old 02-Apr-2007, 22:39
WaltP's Avatar
WaltP WaltP is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Midwest US
Posts: 3,234
WaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to all

Re: need help looping this


When I pointed out
Quote:
Do what that Yellow on Red post titled Read This explains.
You seem to have missed 1A, 2B, 2F, 3, and 6

And you need to look at WHILE loops, like I already suggested. Did you? What you have is just about there. You are simply missing the WHILE statement. Think about where it should go and put one in. We'll help you fix it if you miss. Like we always say, we won't do it for you. But we'll help you fix it.
__________________

Cow: You're a lawyer too?
Mooseblood (mosquito): Ma'am, I was already a bloodsucking parasite. All I needed was a briefcase!
  #3  
Old 02-Apr-2007, 23:02
rbroller815 rbroller815 is offline
New Member
 
Join Date: Apr 2007
Posts: 11
rbroller815 is on a distinguished road

Re: need help looping this


would i put it b4 the if or would it repace the if else statement
  #4  
Old 03-Apr-2007, 07:23
sunboy sunboy is offline
New Member
 
Join Date: Aug 2006
Posts: 7
sunboy is on a distinguished road

Re: need help looping this


CPP / C++ / C Code:
double getA ()
{
  int A;
  cout<<" Please enter the A coefficient ";
  cin>>A;
while(A==0)
 {
    cout<<" Please enter another value that is non-zero"<<endl;
    cin>>A;
 }
	
   return A;
}
This will be ok!I think you should read the c++ books first.
 
 

Recent GIDBlogLast Week of IA Training by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

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

vB 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
Need assistance with looping liquidz76 C++ Forum 0 05-Dec-2006 19:05
Need help with Looping Harryt123 C Programming Language 4 21-May-2006 14:45
Looping fj8283888 C++ Forum 8 11-Apr-2006 21:12
ask looping likeit C Programming Language 4 26-Jul-2005 19:49
for looping prob Rosmayati C Programming Language 1 30-Jun-2004 11:39

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 00:02.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.