1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
|
#include<iostream>
#include<string>
using namespace std;
void enterValue(int,char,int&);
void totalScore(int,int&);
int main()
{
int num[3]={1,2,3},score[3]={0,0,0},a = 0,total_student = 0,totalavg = 0,totalpoint = 0,equal = 0;
bool stop = true, run = false,program;
char name[30],desc[3]={'P','F','C'};
while(name[0] !='-' && name[1] != '1')
{
a = 0;
cout<<"Enter your name(Enter -1 to exit.): ";
cin.getline(name,30);
if (name[0] =='-' && name[1] == '1')
a = 3;
while(a<3)
{
enterValue(num[a],desc[a],score[a]);
totalScore(score[a],totalpoint);
total_student++;
a++;
}
}
totalavg = ((totalpoint/3)/total_student);
cout<<"\n\tEvaluation of the System\n\t ";
while(equal < 32)
{
cout<<"=";
equal++;
}
cout<<"\n\tNumber of students who answered: "<<total_student;
cout<<"\n\tTotal Score Collected: "<< totalpoint;
cout<<"\n\tTotal Average: "<< totalavg;
cout<<"\n\tThe level of Satisfaction: ";
if ( totalavg >= 7)
cout<<"Excellent";
else if (totalavg > 4 && totalavg < 7)
cout<<"Moderate";
else
cout<<"Poor";
return 0;
}
void totalScore(int a,int& b)
{
b += a;
}
void enterValue(int a,char b,int& c)
{
switch(b)
{
case 'P':
if (c < 0 || c > 10)
c = 0;
break;
cout<<"Enter score for Software Performance: ";
cin>>c;
break;
case 'F':
if (c < 0 || c > 10)
c = 0;
break;
cout<<"Enter score for User Friendliness: ";
cin>>c;
break;
case 'C':
if (c < 0 || c > 10)
c = 0;
break;
cout<<"Enter score for System Capabilities: ";
cin>>c;
break;
}
}
|