67 248
Assignments Done
99,3%
Successfully Done
In November 2018

Answer to Question #2760 in C++ for Bahaa

Question #2760
Write a program that reads the marks of a student in the exams (mid-term,final,attendance) and print if succeeded or not.
Expert's answer
#include <iostream.h> //some times this file has title iostream,
without extension. If compilation error write #include <iostream>

#define MAX_MARK 10 //max mark
//if you will have problems write: using namespace std;

void main()
{
int i, n;
int m;
double am;
cout<<"Enter number of exams: "; cin>>n;
am=0;
for(i=0; i<n; i++)
{
& do
& {
& cout<<"Mark number "<<i+1<<": "; cin>>m;
& if(m<0 || m>MAX_MARK) cout<<"Invalid value\n";
& }
& while(m<0 || m>MAX_MARK);
& am+=m;
}
am/=(double)n;
if(am>=MAX_MARK*0.7) cout<<"Student is successful\n";
else cout<<"Student is not successful\n";
cin>>i;//delay until user not to enter some value
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions