#include <iostream>
main() {
int employeeid;
int hoursworked;
float hourlyrate, grosspay;
cout << "ENTER THE EMPLOYEE ID: ";
cin >> employeeid;
cout << "ENTER THE HOURS WORKED: ";
cin >> hoursworked;
cout << "ENTER THE HOURLY RATE: ";
cin >> hourlyrate;
grosspay = hoursworked * hourlyrate;
cout << "EMPLOYEE ID IS " << employeeid << endl;
cout << "THE HOURS WORKED ARE " << hoursworked << endl;
cout << "THE HOURLY RATE IS " << hourlyrate << endl;
cout << "THE GROSSPAY IS " << grosspay << endl;
return 0;
}//MAIN

I am running the program in xcode.....command line utility....c++ tool
where do i place the numbers (id, hours worked, hourly rate)to recieve an output (build and run)
p.s I also get an error message, when i try, next to main() { saying "warning ISO C++ forbids declaration of 'main' with no type

I am lost.

Recommended Answers

All 5 Replies

main has to be an int. I'm not positive, but I believe that should fix everything.

Just change your second line to:

int main() {

Already mentioned you have to use int main() because you have given "return 0" at the end of main.No coding tags ,it puts bad impression.

int main() { works............. now do numbers go on the line with cout or cin (which is input and output)?

cin means input
cout means output.

I'm confused as to what you are asking.

The way you have the program built you're prompted to enter the numbers when you run the program.

simple Cin mean console input , By default it takes value from you keyboard and cout mean console output by default it print value on screen.Your program is very simple to understand . it take employ id , house worked and hourly rate , then it place hourly rate multiplication with house worked in grosspay and finally it print all the values.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.