Not outputting string variable

#include

using namespace std;

int main(){

int gryffindor = 0;

int hufflepuff = 0;

int ravenclaw = 0;

int slytherin = 0;

int answer1, answer2, answer3, answer4;

cout << “The Sorting Hat Quiz!\n\n”;

cout << “Q1) When I’m dead, I want people to remember me as:\n\n”;

cout << “1) The Good\n”;

cout << “2) The Great\n”;

cout << “3) The Wise\n”;

cout << “4) The Bold\n”;

cin >> answer1;

if (answer1 == 1){

hufflepuff++;

} else if (answer1 == 2 ){

slytherin++;

} else if (answer1 == 3){

ravenclaw++;

} else if (answer1 == 4){

gryffindor++;

} else{

cout << “Invalid answer\n”;

}

cout << “Q2) Dawn or Dusk?\n\n”;

cout << “1) Dawn\n”;

cout << “2) Dusk\n”;

cin >> answer2;

if (answer2 == 1){

gryffindor++;

ravenclaw++;

} else if (answer2 == 2 ){

hufflepuff++;

slytherin++;

}

else{

cout << “Invalid answer\n”;

}

cout << “Q3) Do you think Tom is awesome?\n\n”;

cout << “1) Yeah\n”;

cout << “2) No\n”;

cout << “3) No way!\n”;

cout << “4) Of course\n”;

cin >> answer3;

if (answer3 == 1){

gryffindor++;

} else if (answer3 == 2 ){

hufflepuff++;

}else if (answer3 == 3 ){

slytherin++;

}else if (answer3 == 4 ){

ravenclaw++;

}

else{

cout << “Invalid answer\n”;

}

int max;

string house;

if (gryffindor > max){

max = gryffindor;

house = “Gryffindor”;

}if (hufflepuff > max){

max = hufflepuff;

house = “Hufflepuff”;

}if (ravenclaw > max){

max = ravenclaw;

house = “Ravenclaw”;

}if (slytherin > max){

max = slytherin;

house = “Slytherin”;

}

cout << house << “!\n”;

}

Probably annoying to read all this just assuming it’s something related to my string variable so the last part does anyone know what I’m doing wrong?

If you’re posting code to the forums please see- How do I format code in my posts? or consider something like a pastebin or gist. Anything that makes it easier for others to read is good :slightly_smiling_face:.

You might want to mention what is that’s wrong and any compiler errors or otherwise. I guess that’s your title?

I’m not sure if there are other errors but for one at least-
What would you expect as the output of the following?

int max;
int value;
if (max < value) {
    std::cout << "yes";
}

Can’t be sure? Initialisation is important, or at the very least setting values before using them :+1:.

Oooh yep I missed that ty and I’ll make sure to format my code next time thanks