Saturday, February 16, 2008

Find the error

Fill in the blanks in the following code

include _______________

using namespace std;

int __________
{
int mark;

________________________
cin >> mark;

if (mark >= 80)
cout << "Grade is A";
______________
if (mark >= 70)
cout << "Grade is B";
_______________
if (mark >= 60)
cout << "Grade is C";
_________________
if (mark >= 50)
cout << "Grade is D";
__________________
________________

System("pause");

______________
}

4 comments:

peacemaker said...

Fill in the blanks in the following code

# include iostream

using namespace std;

int main ( )
{
int mark;
cout<< " Please enter Mark"<< endl;
cin >> mark;

if (mark >= 80)
cout << "Grade is A";
else
if (mark >= 70)
cout << "Grade is B";
else
if (mark >= 60)
cout << "Grade is C";
else
if (mark >= 50)
cout << "Grade is D";

System("pause");
return 0;
}

peacemaker said...

what causes the error when inputing variables such as (AB)?

I am following the same procedure of the if-else statements with inputs such a (AB), but it outputing the first cout and the last cout at the same time.

mugen said...

peacemaker you forgot the "<" and ">" in "iostream".

Maybe your error for inputing variables like "AB" has to do with how you defined the space.

Did you use "int" or "float"?

Even "char" might not work because its "A" and "B" together and more than one letter is a string. Try defining the space as a string instead.

gr81 said...

peacemaker you forget that system is a common "s"