mardi 19 octobre 2021

why is compiler giving error and a different output than intended? [closed]

hello there fellow users, i have an issue where my compiler is giving out the error for expected ; before {. But i believe that its not neccessary. even so, please feel free to correct me and guide me as to what i have done incorrect. thanks in advance!

#include <iostream>

using namespace std;
   int main()


   {
       int x;
       int y;
       int z;
       cout<<"use numbers\n";
       cin>> x;
       cin>> y;
       if (x=y)
       {
           cout<< "your values are equal";

       }
       else if (x>y)
       {
           cout<< "your value of x is larger than y";
       }
       else (x<y)
       {
           cout<< "value of x is smaller than y";
       }
       cout<<endl<<"thanks";

the issue came at the final else line, what am i doing wrong?

Aucun commentaire:

Enregistrer un commentaire