•
•
•
•
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
![]() |
•
•
Join Date: Nov 2007
Posts: 10
Reputation:
Rep Power: 2
Solved Threads: 0
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;
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;
This is not C++ forum. Ask any mod to move this thread to:
http://www.daniweb.com/forums/forum8.html
http://www.daniweb.com/forums/forum8.html
![]() |
•
•
•
•
•
•
•
•
DaniWeb Site Layout and Usability Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Similar Threads
- Warning: Unknown(): Unable to call () - function does not exist in Unknown on line 0 (PHP)
- how to call a function in href? (ASP.NET)
- Call Function (ASP.NET)
- call a function (C)
- how to call this function...using menu..! (C++)
- Using a for loop to sum an integer n and call function add_it (C)
Other Threads in the Site Layout and Usability Forum
- Previous Thread: using a local server
- Next Thread: Auto-adjust web page to browser window (FrontPage 2000)



Linear Mode