Why its saying test cases failed?

I have tested with multiple test cases, both positive and negative, its giving correct answers only. Then why shows as test case failed?

Also in the solution, the method used is using max function, I have used compare. Max function is not yet taken in the lectures till this point. Then why is that the only correct solution?

#include #include using namespace std; int main() { int num, a = 0; int largest = INT_MIN; cout << “Enter how many numbers to be compared: \n”; cin >> num; cout << “Enter the numbers:\n”; for (int i = 0; i < num; i++) { cin >> a; if (a > largest) { largest = a; } } cout << "The largest number is: " << largest; return 0; }

This is the code I have used.

hi @discobot, corrected

Hi! To find out what I can do, say @discobot display help.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.

Here, whats the wrong part of the code? Its just a different algorithm, why its shown as failed? Its not possible to write the exact code as expected right?

hi @discobot ive commented out your mistakes
u need to print correct msgs
and no need to print extra msgs like enter no this that …

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.