im having this problem
when i try to add

m + 1 = k;

it says this-
*lvalue required as left operand of assignment* in my compiler, please help.
dont mind the unfinished code.

#include <iostream>

using namespace std;

int main()
{

    double b,
    m,
    k;

    string x;

    b = 0.0;
    cout << " GPA calculator " << endl;


    cout << " Is your gpa weighted? " << endl;
    cin >> x;
    while(x == "yes")
    {
        cout << " Enter point: " << endl;
        cin >> m;

    m + 1 = k;
    b += k;
     cout << " Is your gpa weighted? " << endl;
    cin >> x;


    }

    cout << b;
}

Recommended Answers

All 3 Replies

//Well... invert them
k = m + 1;

Oh yeah, I had a problem with that when I was first learning C++ too.

= assigns to whatever is on the left side of it.

thanks a lot man i appreciate it very much

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.