#include <iostream>
using namespace std;
int main()
{
char fname[10]; //first name
char sname[10]; //second name
int age; // age of usr
char ans; // anwnser to question
int hours; // number of hours worked
float income;
cout << "Working Tax Credit"<<endl;
cout << "Could you plaese enter your first name."<<endl; // asks for usrs first name
cin >> fname;
cout << "Could you please enter your second name."<<endl; // asks for usrs secon name
cin >> sname;
cout << "hello " << fname<<endl;
cout << "Could you please enter your age"<<endl; // asks for age
cin >> age;
if (age<25)
{
cout << "sorry ";
cout << fname;
cout << " ";
cout << sname;
cout << " but you may not continue you must be age 25 or over to be elagable for working tax credit"<<endl;
return 0;
}
else
{
cout << "What is your living status?";
cout << "Please type y is you are living with someone or type n if you live alone";
cin >> ans;
}
if (ans='n')
{
cout << "how many hours do you work a week?";
cin >> hours;
}
if (hours>=30)
{
cout << "You work more than 30 hours a week you are elagable for working tax credit";
}
else
{
cout << "sorry ";
cout << fname;
cout << " ";
cout << sname;
cout << " but you may not continue you must work over 30 hours a week to be elagable for working tax credit"<<endl;
return 0;
}
cout << "please enter your yearly income";
cin >> income;
if (income>=8612)
{
cout << "your are entitled to £1180";
}
if (income>=8612)
{
cout <<"your are entitled to £655";
if (income>11701)
{
cout <<"sorry but you are not elagable for working tax credit";
return 0;
}
system("PAUSE");
return EXIT_SUCCESS;
}
Whats wrongThis is one of my projects for college there is one error what is it??
Page 1 of 1
5 Replies - 433 Views - Last Post: 18 December 2008 - 07:46 PM
#1
Whats wrong
Posted 18 December 2008 - 07:17 PM
Replies To: Whats wrong
#2
Re: Whats wrong
Posted 18 December 2008 - 07:30 PM
What is the 'one error'?
Compiler error?
Runtime error?
Please give us a lead. Most people here are busy and don't have time to explore every possible error that might be in your code.
Compiler error?
Runtime error?
Please give us a lead. Most people here are busy and don't have time to explore every possible error that might be in your code.
#3
Re: Whats wrong
Posted 18 December 2008 - 07:34 PM
If you properly indented your code, you would see that the conditional test if(income>=8612) does not have a closing bracket.
& just to add, while it doesn't cause the error, what is the difference between EXIT_SUCCESS & 0?
if (income>=8612) {
cout <<"your are entitled to 655";
}
if (income>11701) {
cout <<"sorry but you are not elagable for working tax credit";
return 0;
}
system("PAUSE");
return EXIT_SUCCESS;
}
& just to add, while it doesn't cause the error, what is the difference between EXIT_SUCCESS & 0?
#4
Re: Whats wrong
Posted 18 December 2008 - 07:40 PM
no2pencil, on 18 Dec, 2008 - 06:34 PM, said:
what is the difference between EXIT_SUCCESS & 0?
"EXIT_SUCCESS" is a macro supplied as part of standard C++ (since I think 1999?) that is considered 'more correct' than using 0.
Here's some more info:
http://www.cplusplus...IT_SUCCESS.html
#5
Re: Whats wrong
Posted 18 December 2008 - 07:43 PM
My point was using both of them looks silly.
#6
Re: Whats wrong
Posted 18 December 2008 - 07:46 PM
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote




|