{ is wrong. move it just below main:
int main()
{
int x; //etc
commas are wrong too:
int x;
double d; //correct
int x,y,z; //correct
int x, ; //incorrect.
10% is incorrect.
int taxrate = 10; //correct.
double taxrate = 0.1; //better?
cout is wrong. cout << "words"; //correct
cout << ("words" blah) ; //incorrect.
fixed with best guess at what you wanted: (note no () on cout, note <<variable<< in cout, note 1-taxrate to get 90% of original value which is same as original value - 10% etc, note
use of double to do the tax, etc...
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
int main()
{
int annualincome ;
double taxrate= 0.10 ;
float finalpay ;
cout<<"Hello please enter your annual income\n";
cin>>annualincome;
cout<<"the tax rate is 10%\n";
finalpay = annualincome* (1.0-taxrate);
cout<<"your final pay is " << finalpay<< endl;
return 0;
}
|
% is the integer remainder in c++ (try it: cout << 11%10 <<endl; ) . percentages are just done as per math, as a decimal where 1.0 = 100%, and remember to deal with inverted percentages ... 10% tax is 10% money paid, 90% kept, so the answer is 90% of the original, which is 0.9 * the value... right?