biggest number [newbie here]

whats wrong with this code ?? can run but my teacher said it's not correct enough.

the question is to find the biggest number.

#include <iostream>
using namespace std;

int main (void)
{
int num, num2, big ;

cout << "first number : " ;
cin >> num ;

cout << "second number : " ;
cin >> num2 ;

if (num>num2)
{
cout << "biggest is " <<num <<endl ;
}

else if (num2>num)
{
cout << "biggest is " <<num2 <<endl ;
}

return 0;
}
> whats wrong with this code ?? can run but my teacher said it's not correct enough.

It does not take care of the case where the two numbers are equal.

And since it is not being used, get rid of the int big.

1
2
// int main (void) // void is unnecessary
int main() // this is how we would write it in C++ 
Topic archived. No new replies allowed.