Question:
You want to rate a mobile phone, according to the following conditions:
(i) Price should be less than 1500 AED.
(ii) Screen size should be at least 4 inches
(iii) Weight should be less than 200 gms.
Your ratings are as follows:
5 stars, if all the conditions above are met.
4 stars, if condition (i) and (ii) are met only
3 stars, if condition (ii) and (iii) are met only
2 stars, if condition (i) and (iii) are met only
0 stars, if none of the conditions above are met.
Input the price (int), screen size (double) and weight (int). Output the stars as per the above criteria.
Note:
This is the the correct code after fixing the errors.
#include<iostream>
using namespace std;
int main()
{
int price, weight, stars, result;
double size;
cout<<"Enter the price: ";
cin>>price;
cout<<"Enter the screen size: ";
cin>>size;
cout<<"Enter the weight: ";
cin>>weight;
>= as well. in general the = is always last for both comparisons and combined assignments
eg
x += 3; // same as x = x+3, but here again, the =+ is an error.
you may want an endl on the 0 stars just for consistency.
you could use * symbol for stars if you wanted to be fancy.