Welcome to Dream.In.Code
Getting C++ Help is Easy!

Join 131,482 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 1,849 people online right now. Registration is fast and FREE... Join Now!




Function Names

 
Closed TopicStart new topic

Function Names

area
post 23 Nov, 2005 - 03:00 PM
Post #1


New D.I.C Head

*
Joined: 22 Nov, 2005
Posts: 22


My Contributions


i keep getting an error message saying i can't use total as function? i declared it as a float?
User is offlineProfile CardPM

Go to the top of the page


Amadeus
post 23 Nov, 2005 - 03:24 PM
Post #2


g++ -o drink whiskey.cpp

Group Icon
Joined: 12 Jul, 2002
Posts: 12,158



Thanked 31 times

Dream Kudos: 25
My Contributions


Please post the code.
User is offlineProfile CardPM

Go to the top of the page

area
post 23 Nov, 2005 - 03:25 PM
Post #3


New D.I.C Head

*
Joined: 22 Nov, 2005
Posts: 22


My Contributions


#include <iostream.h>
#include <stdlib.h>
#include <iomanip.h>


using namespace std;
float total(float quarters,float dimes ,float nickels, float pennies);

int main()
{
float quarters,dimes,nickels,pennies,total;
cout<<"Please enter the number of quarters you have:"<<endl;
cin>>quarters;
cout<<"Please enter the number of dimes you have:"<<endl;
cin>>dimes;
cout<<"Please enter the number of nickels you have:"<<endl;
cin>>nickels;
cout<<"Please enter the number of pennies you have:"<<endl;
cin>>pennies;
cout<<"The total is "<<(quarters,dimes,nickels,pennies)<<total<<endl;
system ("PAUSE");
return 0;
}

float calculatedtotal (float quarters, float dimes, float nickels, float pennies)
{
float returnValue;
returnValue = ((quarters *.25)+(dimes *.10) +(nickels *.05) +(pennies *.01));
return returnValue;
}
User is offlineProfile CardPM

Go to the top of the page

Amadeus
post 23 Nov, 2005 - 03:29 PM
Post #4


g++ -o drink whiskey.cpp

Group Icon
Joined: 12 Jul, 2002
Posts: 12,158



Thanked 31 times

Dream Kudos: 25
My Contributions


I am closing this as it is a duplicate...please see the reply in the other post. Thanks,

Amadeus
User is offlineProfile CardPM

Go to the top of the page

Closed TopicStart new topic
Time is now: 11/20/08 12:00AM

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month