The line has I underlined has an error message of Bathtub not being declared. I want it to be able to recognize if someone types bathtub into the program.
#include <iostream>
int main(){
usingnamespace std;
int x;
string answer ;
cout<<"Welcome to Jumble!";
cout<< endl;
cout<<"We have over 1 words to unjumble!";
cout<< endl;
cout<<"Select a number. Each number represents a puzzle.";
cout<< endl;
cout<<"After Selection, you will see a word. Type it in its unjumbled form.";
cout<< endl;
cout<< "Type a number!";
cout<< endl;
cin>> x;
if (x==1){
cout<< endl;
cout<< "Your word is: bthabtu";
cin>> answer;
if(answer==bathtub){
cout<< endl;
cout<< "You are correct!";
}
The compiler assumes that bathtub is the identifier (name) of a variable, because you didn't use quotes ("").
You always use quotes for string literals - it's no different than the text you're printing using std::cout.