473,395 Members | 1,652 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

C++ Error C2660 When all fuctions are counted

Hey, Im getting two C2660 Errors even though I have defined all my variables and such, and Im not sure why it isnt working, can anyone help me out?

Expand|Select|Wrap|Line Numbers
  1. //Program Project 5
  2. #include<iostream>
  3. #include<iomanip>
  4. #include<fstream>
  5. #include<string>
  6. void print_title(float TotNew, float TotOwed, int NumBasic, int NumPremium, int NumUltra);
  7. void print_ending(char Month[10]);
  8. using namespace std;
  9. int main()
  10. {
  11.     ofstream prn ("PRN");
  12.     int NumEmp, ServCode, ctr=1, NumBasic=0, NumPremium=0, NumUltra=0;
  13.     char Month[10];
  14.     string Name, SrvCode;
  15.     float New_Charge[4] = {0, 45, 75, 100};
  16.     float PrevBal, FinChrg, AmtOwed, TotNew=0, TotOwed=0, NewChrg; 
  17.     const double FINCHRG=0.1;
  18.     cout<<"Enter the Month\n";
  19.     cin>>Month;
  20.     cout<<"Enter Number of Employees\n";
  21.     cin>>NumEmp;
  22.  
  23.     print_title (Month); //One error Happening here 
  24.  
  25.     for(ctr=1; ctr<=NumEmp; ctr++)
  26.     {
  27.         cout<<setprecision(2)<<fixed<<showpoint<<endl;
  28.         cout<<"Enter Customers Name\n";
  29.         cin.ignore();
  30.         getline(cin,Name);
  31.         cout<<"Enter Service Code\n";
  32.         cin>>ServCode;
  33.         cout<<"Enter Previous Balance\n";
  34.         cin>>PrevBal;
  35.         if (ServCode==1);
  36.             New_Charge[1];
  37.             SrvCode= "Basic";
  38.             NumBasic++;
  39.         if (ServCode==2);
  40.             New_Charge[2];
  41.             SrvCode= "Premium";
  42.             NumPremium++;
  43.         if (ServCode==3);
  44.             New_Charge[3];
  45.             SrvCode= "Ultra";
  46.             NumUltra++;
  47.         FinChrg=PrevBal * FINCHRG;
  48.         AmtOwed=PrevBal + FinChrg + NewChrg;
  49.         TotNew+=NewChrg;
  50.         TotOwed+=AmtOwed;
  51.         cout<<setw(20)<<Name<<setw(8)<<SrvCode<<setw(10)<<PrevBal<<setw(10)<<FinChrg<<setw(9)<<NewChrg<<setw(10)<<AmtOwed<<endl;
  52.     }
  53.  
  54.     print_ending (TotNew, TotOwed, NumBasic, NumPremium, NumUltra); //And the other here
  55.  
  56.     return 0;
  57. }
  58.  
  59.     void print_title(char Month[10])
  60.     {
  61.         cout<<setw(50)<<"COBY CABLE MONTHLY REPORT FOR "<<Month<<endl<<endl;
  62.         cout<<setw(29)<<"SERVICE"<<setw(20)<<"FINANCE"<<setw(6)<<"NEW"<<setw(10)<<"AMT"<<endl;
  63.         cout<<setw(20)<<"CUSTOMER NAME"<<setw(8)<<"TYPE"<<setw(11)<<"BALANCE"<<setw(10)<<"CHARGE"<<setw(8)<<"CHARGE"<<setw(8)<<"OWED"<<endl;
  64.         cout<<setw(20)<<"-------- ----"<<setw(8)<<"----"<<setw(11)<<"-------"<<setw(10)<<"------"<<setw(8)<<"------"<<setw(8)<<"----"<<endl;
  65.     }
  66.     void print_ending(float TotNew, float TotOwed, int NumBasic, int NumPremium, int NumUltra)
  67.     {
  68.         cout<<setw(57)<<"-------"<<setw(10)<<"-------"<<endl;
  69.         cout<<setw(53)<<"$ "<<TotNew<<setw(3)<<"$ "<<TotOwed<<endl;
  70.         cout<<endl<<setw(50)<<"Number of Basic:    "<<NumBasic<<endl;
  71.         cout<<setw(50)<<"Number of Premium:  "<<NumPremium<<endl;
  72.         cout<<setw(50)<<"Number of Ultra:    "<<NumUltra<<endl;
  73.     }
Dec 13 '07 #1
6 1811
sicarie
4,677 Expert Mod 4TB
Well, let's look at this:

Expand|Select|Wrap|Line Numbers
  1.     print_title (Month); //One error Happening here 
  2.  
  3.  
So where is that declared?
Expand|Select|Wrap|Line Numbers
  1. // includes here
  2.  
  3. //function definition
  4. void print_title(float TotNew, float TotOwed, int NumBasic, int NumPremium, int NumUltra);
  5.  
  6. //main function here
  7. // . . .
  8.     print_title (Month); //One error Happening here 
  9. // . . . (end of main)
  10.  
  11.  
  12. //function implementation
  13.     void print_title(char Month[10])
  14.     {
  15.         cout<<setw(50)<<"COBY CABLE MONTHLY REPORT FOR "<<Month<<endl<<endl;
  16.         cout<<setw(29)<<"SERVICE"<<setw(20)<<"FINANCE"<<setw(6)<<"NEW"<<setw(10)<<"AMT"<<endl;
  17.         cout<<setw(20)<<"CUSTOMER NAME"<<setw(8)<<"TYPE"<<setw(11)<<"BALANCE"<<setw(10)<<"CHARGE"<<setw(8)<<"CHARGE"<<setw(8)<<"OWED"<<endl;
  18.         cout<<setw(20)<<"-------- ----"<<setw(8)<<"----"<<setw(11)<<"-------"<<setw(10)<<"------"<<setw(8)<<"------"<<setw(8)<<"----"<<endl;
  19.     }
So do you see anything out of place there?
Dec 13 '07 #2
EDIT. Oh Wow, thanks, just caught it. I accidently reversed my call ins, All fixed. Thanks a bunch for the help.
Dec 13 '07 #3
sicarie
4,677 Expert Mod 4TB
Glad I could help - was that the case with the second error as well?
Dec 13 '07 #4
Yea, it was a logic error on my part, when I went through at the top, I identified the right variables to the wrong function. Thanks Again.
Dec 13 '07 #5
sicarie
4,677 Expert Mod 4TB
Good, glad you got it. Feel free to post again if you run into anything else.
Dec 13 '07 #6
Well, I acutally ran into another problem on this one. When I was trying to print, I had
Expand|Select|Wrap|Line Numbers
  1. ofstream prn ("PRN");
in main, and then it wouldnt build, so I added
Expand|Select|Wrap|Line Numbers
  1. ofstream prn ("PRN");
to each of the functions, and when i printed, it printed on 3 pages, each function on a different page, Is there something Im doing wrong, or is there a way to get it to print all on one page?
Dec 14 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Gregory | last post by:
Hi, One of the disadvantages of using error handling with error codes instead of exception handling is that error codes retuned from a function can be forgotten to check thus leading to...
4
by: Richard | last post by:
Hi All, I am using Visual C++ .Net to create a windows forms application and I am getting the following errors when I do a MessageBox::Show in my Form1.cpp file: Form1.cpp(19): error C2653:...
1
by: Andreas Poller | last post by:
Hello, I have the following problem: I have a class deriving from ICustomTypeDescriptor: public __gc class TPropertyBag : public ICustomTypeDescriptor { private: ...
1
by: Child | last post by:
Hi, I am getting the error: "Procedure or function spAddActivity has too many arguments specified. " on a stored procedure insert. I compared the number of parameters in the function and the SP...
3
by: raveneros | last post by:
error C2660: 'checkF' : function does not take 1 parameters this is the error. void checkF(char s,char dStr) { for (int i=0; i<count; ++i) if (strcmp(s, list.getId())==0) ...
1
by: Minx | last post by:
This seems like a cool site, I wish I could have found this sooner. Can someone pls help me with this line of code? I get an error C2660 telling me the function does not take an argument ( The...
2
by: yalbizu | last post by:
#include <iostream> #include <string> #include <fstream> #include <iomanip> using namespace std; const int NO_OF_STUDENTS=20; struct studentType { string studentFName; string studentLName;
1
by: denxx | last post by:
Hi, I am new in C++ and was trying to run a programme where I found an error using the pow statement. Error showed is error C2660: 'pow' : function does not take 1 parameters. As I have a square on...
10
by: charmeda103 | last post by:
My program keeps getting me and error and i dont why here is the error message error C2061: syntax error: identifier 'infile' error C2660: 'ReadDate' : function does not take 6 arguments...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.