dimanche 11 juillet 2021

main.cpp:13:5: error: ‘else’ without a previous ‘if’ (C++) [closed]

#include <iostream>
using namespace std;

int main()
{
    int a;
    cout <<"What is number a?\na = ";
    cin >> a;
    if (a>=0);
    {
        cout <<"Number " << a <<"its positive.";
    }
    else {
        cout <<"Number " << a <<"its negative.";
    }
    return 0;
}

I'm new to c++ and i'm getting this error,but there is a previous "if" so.. someone can help me?

Aucun commentaire:

Enregistrer un commentaire