cout<<"Student with ID number :"<<ID<<" obtains :"<<result;
if <-- I need help on this part please..thx.
{
result >= 80;
cout<<"A";
}
if else
{
result >=70;
cout<<"B";
}
if else
{
result >=60;
cout<<"C";
}
if else
{
result >=50;
cout<<"D";
}
if else
{
result >=0;
cout<<"F";
}
Well, as M562 pointed out your "if" statements are malformed. Looks like you need to bone up on its proper implementation. Also youre using the the "if else statement", Im pretty sure that youre trying to implement the "else if statement", Im not sure if the other one even exist. Lastly, you use a couple of header files ie #include<>'s and thats ok. However, I think they are unneccesary to this particulare program unless this isnt the complete code. My motto.. more code, more complex to read, more of a pain to debug.:)
But it may be a prerequisite for your particular compiler, if so, just forget this last part. However, it maybe worth it to you to give using less header files a try at some point.
Well, as M562 pointed out your "if" statements are malformed. Looks like you need to bone up on its proper implementation. Also youre using the the "if else statement", Im pretty sure that youre trying to implement the "else if statement", Im not sure if the other one even exist. Lastly, you use a couple of header files ie #include<>'s and thats ok. However, I think they are unneccesary to this particulare program unless this isnt the complete code. My motto.. more code, more complex to read, more of a pain to debug.:)
But it may be a prerequisite for your particular compiler, if so, just forget this last part. However, it maybe worth it to you to give using less header files a try at some point.
ok M562 is right.I put the code like that and seems like there is no error.But i want to know for the other part (B,C,D,F) should i use 'if' also or i can use 'else'? and if i use 'else' how should i put it in code?
i'm really2 appreciate it.Thx M562 and others who help me out ^^
hi!
this code is about if-else statement cause each sentence is excuted only if the previous in no far true, that me the student ll get "A" if s/he result is grater then or equal to 80, otherwise "B" if s/he s result is less then 80 and greater then or equal 70 and so on, and what chemera did is the right
:)
Hello friends.
@Rediwan
It seems like you got it correct. The way M562 wrote the if statement is the proper way. You always have to put the condition in the ()'s. And your "if else" statements needed to be reversed to "else if" as demonstrated below. Good luck!
yes kyleepparddtcom of course the condition should be in the () cause this is what ll let u have the result which is one of the output. as i mentioned earlier . :).