| | |
Stuck
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Oct 2006
Posts: 19
Reputation:
Solved Threads: 0
Hi everyone, I have written a program and have encountered a few errors that I can't seem to fix(or don't know how to), any help would be great. Thanks in advance for the help! I'm very new to this so bare with me!:cheesy:
C++ Syntax (Toggle Plain Text)
#include <cstdlib> #include <iostream> #include <iomanip> using namespace std; void get_wages(long[], int[], float[], float[], int); void display_wages(long[], float[], int); int main() { cout << "This program written for cs102 Online.\n"; const int size = 7; long empId[size] = {5658845, 4520125, 7895122, 8777541, 8451277, 1302850, 7580489}; int hours[size]; float pay_rate[size], wages[size]; get_wages(empId, hours, pay_rate, wages, size; display_wages(empId, wages, size); system("PAUSE"); return 0; } void get_wages(long empId[], int hours[], float pay_rate[], float wages[], int size) { cout << "Employee ID number:" << endl; for (int count = 0; count < size; count++) { cout << "Employee ID number: "; cout << empId[count] << endl; cout << "Total number of hours worked: "; cin >> hours[count]; while (hours[count] < 0) { cout << "The hours worked cannot be negative, please enter a positive number. " << endl; cout << "Total number of hours worked: "; cin >> hours[count]; } cout << "Employee's pay rate: "; cin >> pay_rate[count]; while (pay_rate[count] < 6.0); { cout << "The employee's pay rate cannot be less than 6.00, please enter a higher pay rate. " << endl; cout << "Employee pay rate: "; cin >> pay_rate[count]; } wages[count] = pay_rate[count] * hours[count]; // formula for gross wages } } void display_wages (long empId[], float wages[], int size) cout << "\n\n"; cout << "|||Employee ID Number|||Gross Wages|||" << endl; cout << "--------------------------------------" << endl; cout << fixed << showpoint << setprecision(2); for (int count = 0; count < size; count++) { cout << " " << empId[count] << " "; cout << "$ " << wages[count] << endl; } }
Good news - there's only 2 syntax errors here!
You're missing a closing ')' here:
And here, you forgot to place an opening brace '{' to start the function:
You're missing a closing ')' here:
int main()
{
cout << "This program written for cs102 Online.\n";
const int size = 7;
long empId[size] = {5658845, 4520125, 7895122, 8777541, 8451277, 1302850, 7580489};
int hours[size];
float pay_rate[size], wages[size];
get_wages(empId, hours, pay_rate, wages, size;And here, you forgot to place an opening brace '{' to start the function:
void display_wages (long empId[], float wages[], int size) // missing {
cout << "\n\n"; "Technological progress is like an axe in the hands of a pathological criminal."
All my posts may be freely redistributed under the terms of the MIT license.
All my posts may be freely redistributed under the terms of the MIT license.
![]() |
Similar Threads
- Windows XP is stuck! (Windows NT / 2000 / XP)
- Advertisment icons stuck to my desktop!!! (Viruses, Spyware and other Nasties)
- Stuck writing a Function (C++)
- error message when shutting down, startup page stuck to http://dr-search4u.com/ind... (Viruses, Spyware and other Nasties)
- Stuck In Restart Loop (Windows NT / 2000 / XP)
- Help with Class, stuck. (C++)
- CPU use stuck at 100% (Viruses, Spyware and other Nasties)
- Stuck on start up (Windows NT / 2000 / XP)
- Internet explorer 5 gets stuck (Web Browsers)
- stuck in lower case, lost functions (Windows NT / 2000 / XP)
Other Threads in the C++ Forum
- Previous Thread: currency conversion program error
- Next Thread: Should be an easy question to answer
| Thread Tools | Search this Thread |
api array arrays based binary c++ c/c++ calculator char char* class classes code coding compile console conversion convert count database delete deploy desktop developer directshow dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game givemetehcodez google graph gui homeworkhelp iamthwee ifstream input int java lib linkedlist linker linux list loop looping loops map math matrix memory multiple news number numbertoword output pointer problem program programming project python random read recursion recursive reference return rpg sorting string strings temperature template templates test text text-file tree unix url variable vector video visual visualstudio win32 windows winsock wordfrequency wxwidgets






