dimanche 9 août 2020

Why am I getting an 'else without a previous if'' error in C++? [closed]

Im a new person whos trying to learn how to program in C++. I find it very interesting. That being said, Im really, really new so I apologise for a noob question.

Im using CodeBlocks to write in C++ and for some reason Im getting an error 'else' without a previous 'if'

To me, my brackets all look alright, but for some reason I just cant execute it, obviously theres a problem, but I cant pinpoint where it is lol.

Can you please show me?

(This is actually not everything, Ive wanted to add many more lines of code but I already stumbled upon this problem)

Below is the code


#include <iostream>

using namespace std;

int main()
{
bool isHetero = true;
bool isTall = true;
bool isBlondeHair = true;

if(isHetero && isTall && isBlondeHair);{
   cout << "You are a hetero, tall male, with a blonde hair.";
} else(!isHetero && isTall && isBlondeHair);{
   cout << "You are not hetero, but you are tall and you have a blonde hair.";
}



return 0;
}

Aucun commentaire:

Enregistrer un commentaire