grade input - else cout<<"Your Average...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
#include <iostream> using namespace std; void main () { int a, b, c, sum, ave; cout<<"What is your grade in Math?"<<endl; cin>>a; cout<<"What is your grade in English?"<<endl; cin>>b; cout<<"What is your grade in Science?"<<endl; cin>>c; sum = a+b+c; ave = sum/3; if ( a<0 | b<0 | c<0 ) cout<<"ERROR!"<< endl; else if ( a>100 | b>100 | c>100 ) cout<<"ERROR!"<< endl;
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: else { cout<<"Your Average is "<< ave << endl; if (ave<=59) cout<<"your grade is F."<<endl; else if (ave<=69) cout<<"your grade is D."<<endl; else if (ave<=79) cout<<"your grade is C."<<endl; else if (ave<=89) cout<<"your grade is B."<<endl; else if (ave<=100) cout<<"your grade is A."<<endl; } }...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online