i have errors i dont get, please help me understand

0 votes
asked Jan 9, 2018 by TheEagleOfNerf (250 points)
main.cpp: In function 'int main()':

this is my code

#include <iostream>
#include <ctime>

using namespace std;

int main()
{
    srand(time(NULL));
    int ranEncounterFight = (rand() %6) + 1;
    int play1Health = 100;
    int npc1Health = 100;
    int play1NorthSouthCoor = 0;
    int play1WestEastCoor = 0;
    string playAction;
    string playMovement;
    cout << "This is a Pokemon text game made with C++. This is PokePro1." << endl;
    cout << "Controls:\nMovement is WASD.\nAttack Selection is type the name of the attack.\nOption Selection is type the name of the option." << endl;
    cout << "You are in your room. You are just sitting down when your mom calls you to go downstairs. Objective: Go downstairs. For now, press the q key to go up and down stairs." << endl;
    playAction = "moving";
    while(playAction = "moving")
    {
        cin >> playMovement;
        if(playMovement = "W" || "w")
        {
            
        }
    }
    
    return 0;
}

but this is what i get

what does this mean

please help

main.cpp:20:24: error: could not convert 'playAction.std::basic_string<_CharT, _Traits, _Alloc>::operator=, std::allocator >(((const char*)"moving"))' from 'std::basic_string' to 'bool'
     while(playAction = "moving")
                        ^
main.cpp:23:37: error: could not convert 'playMovement.std::basic_string<_CharT, _Traits, _Alloc>::operator=, std::allocator >(1)' from 'std::basic_string' to 'bool'
         if(playMovement = "W" || "w")
                                     ^

1 Answer

0 votes
answered Jan 9, 2018 by TheEagleOfNerf (250 points)
whoops sorry dont reply
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.
...