Can you tell me what it means by undeclared identifier thanks
#include %26lt;iostream%26gt;
#include "stdafx.h"
int main()
{
int apples; //amount of apples
int oranges; //amount of oranges
float total; //amount owed
float applespecial; // price of the apples
float orangeprice; // price of the oranges
float discount; //amount of the discount
cout %26lt;%26lt; "how many apples?" ;
cin %26gt;%26gt; apples ;
cout %26lt;%26lt; "how many oranges? Between one and one hundred";
cin %26gt;%26gt; oranges;
applespecial=int((apples+1)/2);
orangeprice=oranges*1.5; //warning C4244 '='
total=applespecial+orangeprice;
discount=total*(oranges/100);
total=total-discount;
cout %26lt;%26lt; "your total is : " %26lt;%26lt; total;
return 0;
}
Fixing an issue in C++?
I would recommend copying/pasting the entire error you go. It should tell you what identifier is undeclared.
Reply:orangeprice=float(oranges)*1.5;
it will solve
Reply:I'm not sure of this answer. You don't have a function. Why do you have a 'Return 0' at the end? Remove that statement and recompile and try.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment