Hi, I tried to run the following code, but the output give 2 result when i insert a number (eg:56), may I know how to give only one output for each mark? eg: 56 only shows Pass instead of both Pass and Fail
#include <iostream>
#include <conio>
int main ()
{
double mark;
cout<<"Enter your Test 1 mark>>";
cin>>mark;
if (mark>=80)
cout<<"TEST 1 -> Good"<<endl;
elseif (mark<80 & mark>=50)
cout<<"TEST 1 -> Pass"<<endl;
else (mark<50);
cout<<"TEST 1 -> Fail"<<endl;
cout<<"Try your best in your TEST 2"<<endl;
getch();
return 0;
}
Hi, Moschops, I'm using Borland C++ to run this program, that's why I don't use namespaces, but when I use Ms Visual Studio C++, I got use usingnamespace std; is that wat u mean? TQ...
And somemore, after I tried both of ur method above, I still got 2 answer, both Pass and Fail when tested with "56".
Hi, Moschops, I did add if but does not notice there is ;, now problem solve, thanks! anyway, is there any wrong by adding ;? when should i add and when should not?