I'm trying to figure out how to make an input with a string thats part of an if statement.
how i think it should be done
#include <iostream>
#include <string>
using namespace std;
int main()
{
string choose;
cout << "Please choose: ";
cin >> choose;
if ((choose = 'ss') || (choose = 'SS'))
{
do this stuff
}
if ((choose = 'aa') || (choose = 'AA'))
{
do this other stuff
}
}
but i get a strange warning (not an error, but something that is like "just letting you know" i suppose)
and when i enter in ss or SS or aa or AA, it breaks my app.
The warning that you're getting is likely emitted from using multi-byte characters. Character literals may only consist of a single character. Perhaps you should use a std::string instead?
You can read the full story here, but simply put, if the strings are equal, the method returns 0. http://www.cplusplus.com/reference/string/string/compare/