User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Site Layout and Usability section within the Web Development category of DaniWeb, a massive community of 455,964 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,609 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Site Layout and Usability advertiser: Internet Marketing Services
Views: 479 | Replies: 1
Reply
Join Date: Nov 2007
Posts: 10
Reputation: black3 is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
black3 black3 is offline Offline
Newbie Poster

Call to a Function more than once

  #1  
Nov 18th, 2007
I have a program to write as part of assignment for class, using C++ of course and using functions. Basically I have to write a Resistor Colour Code Calculator which will allow a user to input the colours and it would give them a value as well as a tolerance range. I am currently having trouble writing the part for the first two bands which are the significant figures. Form what I can see I need to call the Significant Figures function twice, and I have no idea how to do it.

int sigfig () //Significant Figures Function
{
string sband1,sband2,sband3,sband4;
int nband,nband2,nband3,nband4, count;

cout << "Please enter colour of band 1";
cin >> sband1;
//while (count !=1)
//{
//count = count +1;
if (sband1 == "black")
{
nband=0;
}

int main() // Main Function
{
string band1, band2, band3, band4, result, colour, func, band;

band1 = sigfig ();
cout << band1;

cout << "Please enter colour of band 2";
cin >> band2;

band2 = sigfig ();
cout << band2;

cout << "Please enter colour of band 2";
cin >> band2;
cout << "Please enter colour of band 3";
cin >> band3;
cout << "Please enter colour of band 4";
cin >> band4;
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Oct 2006
Location: India
Posts: 1,289
Reputation: vishesh is on a distinguished road 
Rep Power: 5
Solved Threads: 32
vishesh's Avatar
vishesh vishesh is offline Offline
Nearly a Posting Virtuoso

Re: Call to a Function more than once

  #2  
Nov 18th, 2007
This is not C++ forum. Ask any mod to move this thread to:

http://www.daniweb.com/forums/forum8.html
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb Site Layout and Usability Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the Site Layout and Usability Forum

All times are GMT -4. The time now is 9:01 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC