This is what I have to do:
In most companies the amount of vacation you receive depends on the number of years you've been with the company. Create a c++ program that will allow the user to enter the number of years and you output the weeks of vacation according to the following:
0 years, 0 weeks vacation
1-5 years, 1 weeks vacation
6-10 years, 2 weeks vacation
11+ years, 3 weeks vacation
Prompt the user if they would like to enter another employee. Also personalize your program by naming your company!
For some reason, the code that I have created is NOT working correctly, and I have tried changing this and changing that with still no success. Here is my code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
#include <iostream>
using namespace std;
int main( )
{
int years;
bool tryAgain = true;
while ( tryAgain == true )
{
cout << "How many years have you been with us?\n";
cin >> years;
{
if (years == 0)
{
cout << "Sorry, no vacation days yet available";
}
else if (years >= 5 )
{
cout << "Congratulations, you have 1 week Vacation!";
}
}
if (years <5 >10 )
{
cout << "Congratulations, you have 2 week Vacation!\n";
}
}
do while (years <11 ==100 )
{
cout << "Congratulations, you have 3 week Vacation!\n";
}
while
cout << "Would another employee like to enter their data? <y/n> : ";
cin >> choice;
if ( choice == 'n' || choice == 'N' )
{
tryAgain = false;
}
}
return 0;
}
|
Can someone PLEASE explain to me where I am goofing up at? I know it is probably something small, but I can NOT figure it out!.
These are all the erros I am getting:
C:\Documents and Settings\Kris_2\Desktop\PTC\Summer 2013\CPT 232\Meeting calculator.cpp In function `int main()':
39 C:\Documents and Settings\Kris_2\Desktop\PTC\Summer 2013\CPT 232\Meeting calculator.cpp expected `(' before "cout"
39 C:\Documents and Settings\Kris_2\Desktop\PTC\Summer 2013\CPT 232\Meeting calculator.cpp expected `)' before ';' token
40 C:\Documents and Settings\Kris_2\Desktop\PTC\Summer 2013\CPT 232\Meeting calculator.cpp `choice' undeclared (first use this function)
48 C:\Documents and Settings\Kris_2\Desktop\PTC\Summer 2013\CPT 232\Meeting calculator.cpp expected unqualified-id before "return"
48 C:\Documents and Settings\Kris_2\Desktop\PTC\Summer 2013\CPT 232\Meeting calculator.cpp expected `,' or `;' before "return"
50 C:\Documents and Settings\Kris_2\Desktop\PTC\Summer 2013\CPT 232\Meeting calculator.cpp expected declaration before '}' token
Can someone PLEASE help me straighten out my code?
Thank you!