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 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
|
#include<iostream>
#include<random>
using namespace std;
class Result
{
private :
default_random_engine dre;
int high,low;
public :
Result()
{
high=Timer(1,1000);
low=Timer(1,1000);
}
~Result()
{ delete this; }
int getOpinion()
{
string s;
int opine;
cout<<"Enter your opinion of your exam,ie, how did/will it go??? Excellent(E) , Very Good(VG) , Good(G) , Okay(O) , Bad(B) , Very Bad(VB) "<<endl;
cin>>s;
/* if((s!="Excellent") || (s!= "Very Good") || (s!="Good") || (s!="Okay") || (s!="Bad") || (s!="Very Bad"))
* {
* cout<<"Bad choice!!! Exiting.\n";
* return 0;
} */
if(s=="E") {opine= 0; return opine;} // 95 to 90
else if(s=="VG") {opine =1; return opine;} // 90 to 85
else if(s=="G") { opine = 2 ; return opine; } // 85 to 70
else if(s=="O") {opine=3; return opine;} //70 to 55
else if(s=="B") {opine=4; return opine;} // 55 to 40
else if(s=="VB") {opine=5; return opine;} //40 to 20
else { cout<<"Bad choice!!! Exiting.\n"; return 0;}
}
inline int Timer(int a,int b)
{
std::uniform_int_distribution<int> di(a,b);
int c;
for(int i=1;i<1000;i++)
{
c=di(dre);
}
return c;
}
int compResult()
{
int result = 0;
int o;
o = getOpinion();
if(o==0)
{
result= Timer(90,95);
return result;
}
else if(o==1)
{
result= Timer(85,90);
return result;
}
else if( 0 == 2 )
{
result = Timer(70,85);
return result;
}
else if(o==3)
{
result= Timer(55,70);
return result;
}
else if(o==4)
{
result= Timer(40,55);
return result;
}
else if(o==5)
{
result = Timer(20,40);
return result;
}
return result;
}
int getExamResult()
{
int a;
a = compResult();
return a;
}
};
|