what do these error messages mean

0 votes
asked Jan 30, 2018 by TheEagleOfNerf (250 points)

got this code

#include <iostream>
#include <ctime>

using namespace std;

int main ()
{
    srand(time(NULL));
    cout << "This is a decision-based life simulator. Every move you make influences your future, even the small ones. With that said, here's the life simulator!" << endl;
    cout << "What gender are you?\n1. Male\n2. Female" << endl;
    cout << "Tip: To answer these questions, type the number of its option." << endl;
    int Gender;
    cin >> Gender;
    cout << "You just graduated from high school. What do you do?\n1: Get a low-skill job.\n2: Go to college." << endl;
    int College;
    cin >> College;
    int HiringChance;
    if(Gender == 1 && College == 1)
    {
        HiringChance = 90;
    }
    else if(Gender == 2 && College == 1)
    {
        HiringChance = 75;
    }
    if(College == 1)
    {
        cout << "You decided to not go to college. What job do you get?\n1. Subway employee\n2. Mcdonald's employee\n3. Wendy's employee" << endl;
        int Job;
        cin >> Job;
        float WeeklyWage;
        if(Job == 1)
        {
            WeeklyWage = 342.8;
        }
        else if(Job == 2)
        {
            WeeklyWage = 309.2;
        }
        else if(Job == 3)
        {
            WeeklyWage = 356.4;
        }
        cout << "Do you stay in your parents' house?\n1. Yes\n2. No" << endl;
        int House;
        cin >> House;
        float Money;
        if(House == 1 && Job == 1)
        {
            cout << "First week economics: " << Money += 12500 <<  endl;
        }
        
    return 0;
    
}

got these errors

main.cpp: In function 'int main()':
main.cpp:50:68: error: invalid operands of types 'int' and '' to binary 'operator<<'
             cout << "First week economics: " << Money += 12500 <<  endl;
                                                                    ^
main.cpp:55:1: error: expected '}' at end of input
 }
 ^
what in the world do the errors mean
pls help

3 Answers

0 votes
answered Jan 30, 2018 by TheEagleOfNerf (250 points)
well just found out the second error so just answer the first one
0 votes
answered Jan 30, 2018 by sbs0034 (180 points)

You can't set perform operations like setting an int equal to itself + some other number in a cout. That's like saying `cout << "First week economics: " << Money = Money + 12500 << endl;`, which is not allowed.

Instead, do

```c++

Money += 12500;

cout << "First week economics: " << Money <<  endl;

```

0 votes
answered Feb 3, 2018 by Richard Igbiriki
#include <iostream>
#include <ctime>

using namespace std;

int main ()
{
    srand(time(NULL));
    cout << "This is a decision-based life simulator. Every move you make influences your future, even the small ones. With that said, here's the life simulator!" << endl;
    cout << "What gender are you?\n1. Male\n2. Female" << endl;
    cout << "Tip: To answer these questions, type the number of its option." << endl;
    int Gender;
    cin >> Gender;
    cout << "You just graduated from high school. What do you do?\n1: Get a low-skill job.\n2: Go to college." << endl;
    int College;
    cin >> College;
    int HiringChance;
    if(Gender == 1 && College == 1)
    {
        HiringChance = 90;
    }
    else if(Gender == 2 && College == 1)
    {
        HiringChance = 75;
    }
    if(College == 1)
    {
        cout << "You decided to not go to college. What job do you get?\n1. Subway employee\n2. Mcdonald's employee\n3. Wendy's employee" << endl;
        int Job;
        cin >> Job;
        float WeeklyWage;
        if(Job == 1)
        {
            WeeklyWage = 342.8;
        }
        else if(Job == 2)
        {
            WeeklyWage = 309.2;
        }
        else if(Job == 3)
        {
            WeeklyWage = 356.4;
        }
        cout << "Do you stay in your parents' house?\n1. Yes\n2. No" << endl;
        int House;
        cin >> House;
        float Money;
        if(House == 1 && Job == 1)
        {
            cout << "First week economics: " << Money + 12500 <<  endl;
        }
    }
        
    return 0;
    
}
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...