I got two error saying "Error 2 error C2064: term does not evaluate to a
function taking 2 arguments" from the code below. I don't understand why or
what is wrong. Can anyone tell me what I did wrong. I am to C++. Thanks
#include <iostream>
#include <iomanip>
#include <string>
//#include <stdlib>
//#include <math>
using namespace std;
//function phototype
int NumberOfEmploye e (void);
int DaysOut(int);
int AverageDaysOut( int, int);
// variable declarations
//int NumberOfEmploye e, TotalDaysOut, DaysOut;
//float AverageDaysOut;
void main()
{ int NumberOfEmploye e, TotalDaysOut;
int AverageDaysOut;
//cout<<setprecis ion(2);
//cout.setf(ios:: fixed | ios::showpoint) ;
NumberOfEmploye e=NumberOfEmplo yee();
TotalDaysOut=Da ysOut(NumberOfE mployee);
AverageDaysOut= AverageDaysOut( NumberOfEmploye e, TotalDaysOut);
cout<<"The number of Employee in your company is "<<NumberOfEmpl oyee<<endl;
cout<<"The total number of days all of your company's employee missed is
"<<TotalDaysOut <<endl;
cout<<"The average days missed for each employee is "<<AverageDaysO ut<<endl;
}
int NumberOfEmploye e (void)
{
int NumberOfEmploye e;
cout<<"How many employees does your company has?: ";
cin>>NumberOfEm ployee;
while (NumberOfEmploy ee < 1)
{
cout<<"Enter the number of employees greater 1: ";
cin>>NumberOfEm ployee;
}
return NumberOfEmploye e;
}
int DaysOut(int NumberOfEmploye e)
{
int TotalDaysOut, DaysOut;
for (int count =1; count <= NumberOfEmploye e; count++)
{
cout<<"How many days did employee "<<count<<" missed work during the past
year? : ";
cin>>DaysOut;
while(DaysOut < 0)
{
cout<<"Enter a positive days out: ";
cin>>DaysOut;
}
TotalDaysOut +=DaysOut;
return TotalDaysOut;
}
}
int AverageDaysOut( int NumberOfEmploye e, int TotalDaysOut)
{
int AverageDaysOut;
AverageDaysOut = TotalDaysOut/NumberOfEmploye e;
return AverageDaysOut;
} 8 1613
"Richard" <no********@yah oo.com> wrote in message
news:3o******** ************@co mcast.com... I got two error saying "Error 2 error C2064: term does not evaluate to a function taking 2 arguments" from the code below. I don't understand why or what is wrong. Can anyone tell me what I did wrong. I am to C++. Thanks
See below #include <iostream>
#include <iomanip>
#include <string>
//#include <stdlib>
//#include <math>
using namespace std;
//function phototype
int NumberOfEmploye e (void);
int DaysOut(int);
int AverageDaysOut( int, int);
// variable declarations
//int NumberOfEmploye e, TotalDaysOut, DaysOut;
//float AverageDaysOut;
void main()
{ int NumberOfEmploye e, TotalDaysOut;
int AverageDaysOut;
//cout<<setprecis ion(2);
//cout.setf(ios:: fixed | ios::showpoint) ;
NumberOfEmploye e=NumberOfEmplo yee();
TotalDaysOut=Da ysOut(NumberOfE mployee);
AverageDaysOut= AverageDaysOut( NumberOfEmploye e, TotalDaysOut);
cout<<"The number of Employee in your company is "<<NumberOfEmpl oyee<<endl;
cout<<"The total number of days all of your company's employee missed is "<<TotalDaysOut <<endl;
cout<<"The average days missed for each employee is "<<AverageDaysO ut<<endl;
}
int NumberOfEmploye e (void)
{
int NumberOfEmploye e;
cout<<"How many employees does your company has?: ";
cin>>NumberOfEm ployee;
while (NumberOfEmploy ee < 1)
{
cout<<"Enter the number of employees greater 1: ";
cin>>NumberOfEm ployee;
}
return NumberOfEmploye e;
}
int DaysOut(int NumberOfEmploye e)
{
int TotalDaysOut, DaysOut;
for (int count =1; count <= NumberOfEmploye e; count++)
{
cout<<"How many days did employee "<<count<<" missed work during the past year? : ";
cin>>DaysOut;
while(DaysOut < 0)
{
cout<<"Enter a positive days out: ";
cin>>DaysOut;
}
TotalDaysOut +=DaysOut;
return TotalDaysOut;
}
}
int AverageDaysOut( int NumberOfEmploye e, int TotalDaysOut)
{
int AverageDaysOut;
AverageDaysOut = TotalDaysOut/NumberOfEmploye e;
return AverageDaysOut;
}
You're in serious need of some good books and/or
paying attention in class. :-)
#include <iostream>
#include <ostream>
using namespace std;
int NumberOfEmploye e (void);
int DaysOut(int);
double AverageDaysOut( int, int);
int main()
{
int NumOfEmployee(0 );
int TotalDaysOut(0) ;
double AvgDaysOut(0);
NumOfEmployee = NumberOfEmploye e();
TotalDaysOut = DaysOut(NumOfEm ployee);
AvgDaysOut = AverageDaysOut( NumOfEmployee, TotalDaysOut);
cout << "The number of Employee in your company is "
<< NumOfEmployee << endl;
cout << "The total number of days all of "
"your company's employee missed is "
<< TotalDaysOut << endl;
cout << "The average days missed for each employee is "
<< AvgDaysOut << endl;
return 0;
}
int NumberOfEmploye e (void)
{
int NumOfEmployee(0 );
cout << "How many employees does your company has?: ";
cin >> NumOfEmployee;
while (NumOfEmployee < 1)
{
cout << "Enter the number of employees greater 1: ";
cin >> NumOfEmployee;
}
return NumOfEmployee;
}
int DaysOut(int NumOfEmployee)
{
int TotalDaysOut(0) ;
int daysOut(0);
for (int count = 1; count <= NumOfEmployee; count++)
{
cout << "How many days did employee " << count
<< " missed work during the past year? : ";
cin >> daysOut;
while(daysOut < 0)
{
cout << "Enter a positive days out: ";
cin >> daysOut;
}
TotalDaysOut += daysOut;
}
return TotalDaysOut;
}
double AverageDaysOut( int NumOfEmployee, int TotalDaysOut)
{
return static_cast<dou ble>(TotalDaysO ut) / NumOfEmployee;
}
-Mike
I got a pretty bad professor and a pretty old book. I got one more
question. I need to create a function which prompt user to enter any
particular month in the year such as January, March or ect. I need to
validate the Month entered. If the user entered Match instead of March, I
need to print out a message telling the user to try again. So far, I can
think of a way to do this. Can you guys me a method and I will try to write
the code. Here is how i do it so far. Thanks.
#include <iostream>
#include <iomanip>
#include <string>
#include <stdlib.h>
using namespace std;
// function phototype
char GetMonth (void);
int main()
{
GetMonth();
}
char GetMonth(void)
{
cout<<"What month do you need to calculate customer usage charge? :";
cin>>Month;
// validation of month go here, but I cannot find a method
return Month[12];
>>>>
int NumOfEmployee(0 );
int TotalDaysOut(0) ;
double AvgDaysOut(0);
Why do you the 0 inside the parenthesis and why is the parenthesis there? I
don't get this point. please help. My book does not do anything like that.
the code was not correct here is the correct one for the month function:
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
// function phototype
char GetMonth (void);
// variable declaration
char Choice ,Month[12];
char January[12]="January",
February[12]="February",Mar ch[12]="March",Apr il[12]="April";
char
May[12]="May",June[12]="June",July[12]="July",Augu st[12]="August",Septe mber[12]="September" ;
char October[12]="October", November[12]="November",Dec ember[12]="December";
int main()
{
GetMonth();
}
char GetMonth(void)
{
cout<<"What month do you need to calculate customer usage charge? :";
cin>>Month;
// validation of month go here, but I cannot find a method
return Month[12];
}
Richard wrote: I got two error saying "Error 2 error C2064: term does not evaluate to a function taking 2 arguments" from the code below. I don't understand why or what is wrong. Can anyone tell me what I did wrong. I am to C++. Thanks
#include <iostream>
#include <iomanip>
#include <string>
//#include <stdlib>
//#include <math>
using namespace std;
//function phototype
int NumberOfEmploye e (void);
int DaysOut(int);
int AverageDaysOut( int, int);
// variable declarations
//int NumberOfEmploye e, TotalDaysOut, DaysOut;
//float AverageDaysOut;
void main()
{ int NumberOfEmploye e, TotalDaysOut;
int AverageDaysOut;
//cout<<setprecis ion(2);
//cout.setf(ios:: fixed | ios::showpoint) ;
NumberOfEmploye e=NumberOfEmplo yee();
TotalDaysOut=Da ysOut(NumberOfE mployee);
AverageDaysOut= AverageDaysOut( NumberOfEmploye e, TotalDaysOut);
cout<<"The number of Employee in your company is "<<NumberOfEmpl oyee<<endl;
cout<<"The total number of days all of your company's employee missed is "<<TotalDaysOut <<endl;
cout<<"The average days missed for each employee is "<<AverageDaysO ut<<endl;
}
int NumberOfEmploye e (void)
{
int NumberOfEmploye e;
cout<<"How many employees does your company has?: ";
cin>>NumberOfEm ployee;
while (NumberOfEmploy ee < 1)
{
cout<<"Enter the number of employees greater 1: ";
cin>>NumberOfEm ployee;
}
return NumberOfEmploye e;
}
int DaysOut(int NumberOfEmploye e)
{
int TotalDaysOut, DaysOut;
for (int count =1; count <= NumberOfEmploye e; count++)
{
cout<<"How many days did employee "<<count<<" missed work during the past year? : ";
cin>>DaysOut;
while(DaysOut < 0)
{
cout<<"Enter a positive days out: ";
cin>>DaysOut;
}
TotalDaysOut +=DaysOut;
return TotalDaysOut;
}
}
int AverageDaysOut( int NumberOfEmploye e, int TotalDaysOut)
{
int AverageDaysOut;
AverageDaysOut = TotalDaysOut/NumberOfEmploye e;
return AverageDaysOut;
}
Your code is so ugly, I dont even feel like looking into it.
Richard wrote: >>>>
int NumOfEmployee(0 ); int TotalDaysOut(0) ; double AvgDaysOut(0);
Why do you the 0 inside the parenthesis and why is the parenthesis there? I don't get this point. please help. My book does not do anything like that.
The code
int i(0);
initializes the integer i with zero, i.e., the constructor of the class
int is called. For integral types like "int" or "double", this syntax
should essentially be equivalent with
int i=0;
The point is that, using the syntax "C c(x);", where C is a class and x
an instance of C, one usually saves one default constructor call. This
is due to the fact that in "C c = x;", the object c is initialized first
with its default constructor, and after that the corresponding
=-operator is called. However, a quantitative benefit will only show up
when more complicated classes C than integral types are used.
Richard wrote: I got a pretty bad professor
You're kind of stuck with this, unless you drop the course.
and a pretty old book.
This you can fix. I suggest Accelerated C++ by Koenig and Moo.
Brian
--
Please quote enough of the previous message for context. To do so from
Google, click "show options" and use the Reply shown in the expanded
header.
On Fri, 21 Oct 2005 00:17:55 -0500, Richard wrote: // variable declaration char Choice ,Month[12];
char January[12]="January", February[12]="February",Mar ch[12]="March",Apr il[12]="April";
char May[12]="May",June[12]="June",July[12]="July",Augu st[12]="August", September[12]="September" ;
char October[12]="October", November[12]="November",Dec ember[12]="December";
Having all the month names exactly 12 characters long doesn't really make
sense. But having said that, you probably don't want separate arrays for
each month name anyway. Make Month an array of characters strings; then
you can index into it to get the month name.
const char* Month[] =
{
"January",
"February",
"March",
// Add the rest of the month names here...
};
- Jay This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: BlueDragon |
last post by:
The place where I work is moving to MS SQL Server from Lotus Notes. I
have done a lot of coding in Lotus Notes, and have, I suppose,
intermediate skills in basic SQL -- queries, insert, updates, table
design, etc. I have a couple of questions, however. First, stored
procedures vs. functions. In my world, a function is a body of code
that returns a value; a procedure is a body of code that does things
but does not return a value (other than...
|
by: Gibby Koldenhof |
last post by:
Hiya,
Terrible subject but I haven't got a better term at the moment.
I've been building up my own library of functionality (all nice conforming
ISO C) for over 6 years and decided to adopt a more OO approach to fit my
needs. Altough I used an OO approach previously for some subparts of the
library it became somewhat difficult to maintain all those parts since they
really are the same thing coded for each part (code duplication). So...
|
by: anoop |
last post by:
Hello,
I created a Public class in .aspx.vb code behind file, now I want
to know can I call that functions in the class in the Scripts either client
side or server side in .aspx page. also I want to associate those functions
with the click of the button which is accesible in .aspx file. what should I
do.
Thank
you
|
by: Martin Jørgensen |
last post by:
Hi,
Problem:
========
Some of my output functions are beginning to take pretty many
arguments... I mean.... We're talking about 10-15 arguments :-)
So I thought to myself, perhaps this is beginning to get out of hands if
I continue to put in extra functionality in the (file-writing)
output-functions....
|
by: Simon Dean |
last post by:
Hi,
I have a couple of questions. If you don't mind. Sorry, I do get a bit
wordy at times. First one just throws some thoughts around hoping for
answers :-)
1) Anyone got a theory on the usage of PHP Classes rather than an actual
technical guide? I've seen loads of things that show how to put together
a class, but without actually necessarily saying why you'd want to use a
class over say a separate file of functions or explaining:
| |
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
| |
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |