Help with little code.

Write your question here.

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
  #include <iostream>

using namespace std;

int main()
{
    cout << "Enter your name and Sirname and age. \n";
    string firstName;
    string secondName;
    cin >> firstName >> secondName;
    cout << "Hello " << firstName << " " << secondName << endl;
    cout << "Enter your weight and it will calculate how fat you are \n";
    string fat;
    cin >> fat;
    int a;
    a = 25;
    int b;
    b = 50;
    int c;
    c = 75;
    if (fat <= a)
        cout << "You are not fat";
    if (fat <= b)
        cout << "You are a fat person";
    if (fat >= c)
        cout << "You are a very fat person";
}


Im getting an error in the if (fat <= a) part, Im noob so please help me. Thanks,
At lines 21, 23, 25, you're trying to compare a string (fat) to an integer (a).
Not a valid comparison.


You are trying to compare a string with an integer. To solve this, change string fat; to int fat;
Thanks, I mistake something. Thanks.
Topic archived. No new replies allowed.