/*
An example of badly written program
This program grabs data from a user and displays it
Nothing much to say about it
Try to understand the code :)
*/
#include
#include
#include
#include
#include
void main()
{
float max, ss, ss1, sci, sci1, eng, eng1, math, math1, bio, bio1, it, it1, com, com1, sel, sel1, hin, hin1; //variables with importance!
float engp, gengval, selp, gselval, scip, gscival, itp, gitval, biop, gbioval, comp, gcomval, mathp, gmathval, ssp, gssval, hinp, ghinval, totp, gtotval;
int data_switch, opt, strm, strm1, tot, selopt, std;
char fname[20], fname1[20], lname[20], lname1[20], roll[2], roll1[2], div, div1[20]; //things which doesnt have anything to do with calculations
menu:
clrscr();
cout<<"What do you want to do?"<
cout<<"1] Enter Data"<
cout<<"2] Enter Comparison Data"<
cout<<"3] See Results"<
cout<<"4] See Comparison"<
cout<<"5] About"<
cout<<"6] Exit"<
cout<<"Enter a choice (1-8): ";
cin>>opt;
if (opt>8 || opt<1)
{
clrscr();
cout<<"You must enter a choice between 1 and 8";
getch();
goto menu;
}
if (opt==1)
{
data:
data_switch=1;
clrscr();
cout<<"Enter First Name: ";
cin>>fname;
clrscr();
cout<<"Enter Last Name: ";
cin>>lname;
std:
clrscr();
cout<<"Enter Standard (1-12): ";
cin>>std;
if (std>12 || std<1)
{
clrscr();
cout<<"You must enter a choice between 1 and 12!";
getch();
goto std;
}
clrscr();
cout<<"Enter Division: ";
cin>>div;
clrscr();
cout<<"Enter Roll: ";
cin>>roll;
clrscr();
if (std==11)
{
goto strm;
}
else if (std==12)
{
goto strm;
}
else
{
goto stdin;
}
strm:
clrscr();
cout<<"Enter Stream: "<
cout<<"1] Medicine"<
cout<<"2] Engineering"<
cout<<"3] Commerce"<
cout<<"Enter a choice (1-3): ";
cin>>strm;
if (strm>3)
{
cout<<"You must enter a choice between 1 and 3\n";
getch();
goto strm;
}
stdin:
clrscr();
cout<<"Max marks that can be scored per subject: ";
cin>>max;
eng:
clrscr();
cout<<"Marks obtained for English: ";
cin>>eng;
if (eng>max)
{
cout<<"You must enter marks within the maximum limit!\n";
getch();
goto eng;
}
selin:
clrscr();
cout<<"Do you have Secondary Language?\n";
cout<<"1] Yes\n";
cout<<"2] No\n";
cout<<"Enter a choice (1-2): ";
cin>>selopt;
if (selopt==1)
{
sel:
clrscr();
cout<<"Marks obtained for secondary language: ";
cin>>sel;
if (sel>max)
{
cout<<"You must enter marks within the maximum limit!\n";
getch();
goto sel;
}
}
else
{
cout<<"You must enter a choice between 1 and 2!";
getch();
goto selin;
}
ss:
clrscr();
if (std<11)
{
cout<<"Marks obtained for Social Science: ";
cin>>ss;
if (ss>max)
{
cout<<"You must enter marks within the limit!\n";
getch();
goto ss;
}
}
it:
clrscr();
if (std<=10)
{
cout<<"Marks obtained for Computer Science: ";
cin>>it;
if (it>max)
{
cout<<"You must enter marks within the maximum limit!\n";
getch();
goto it;
}
}
if (std>10)
{
if (strm==1)
{
msci:
clrscr();
cout<<"Marks obtained for Science (excluding Biology): ";
cin>>sci;
if (sci>max)
{
cout<<"You must enter marks within the maximum limit!\n";
getch();
goto msci;
}
}
if (strm==2)
{
goto sci;
}
if (strm==3)
{
goto com;
}
}
sci: //pointing geeks to this place :)
clrscr();
cout<<"Marks obtained for Science ";
cin>>sci;
if (sci>max)
{
cout<<"You must enter marks within the limit!\n";
getch();
goto sci;
}
math:
clrscr();
cout<<"Marks obtained for Maths: ";
cin>>math;
if (math>max)
{
cout<<"You must enter marks within the limit!\n";
getch();
goto math;
}
hsit:
clrscr();
if (strm==2) //custom input for seperate streams!
{
cout<<"Marks obtained for Computer Science: ";
cin>>it;
if (it>max)
{
cout<<"You must enter marks within the limit!\n";
getch();
goto hsit;
}
}
med:
clrscr();
if (strm==1)
{
cout<<"Marks obtained for Biology: ";
cin>>bio;
if (bio>max)
{
cout<<"You must enter marks within the limit!\n";
goto med;
}
}
com: //Just a label, to direct commerce students away from the hassle of science!
clrscr();
if (strm==3)
{
cout<<"Marks obtained for Commerce: ";
cin>>com;
if (com>max)
{
cout<<"You must enter marks within the limit!\n";
getch();
goto com;
}
cit:
clrscr();
cout<<"Marks obtained for Computer Science: ";
cin>>it;
if (it>max)
{
cout<<"You must enter marks within the limit!\n";
getch();
goto cit;
}
}
hin:
if (std<11)
{
clrscr();
cout<<"Marks obtained for Hindi: ";
cin>>hin;
if (hin>max)
{
cout<<"YOu must enter marks within the limit!\n";
getch();
goto hin;
}
}
clrscr();
cout<<"Data has succesfully been entered!\n";
cout<<"Please press Return to continue...";
getch();
goto menu;
}
if (opt==2)
{
clrscr();
cout<<"Enter First Name: ";
cin>>fname1;
clrscr();
cout<<"Enter Last Name: ";
cin>>lname1;
clrscr();
cout<<"Enter Division: ";
cin>>div1;
clrscr();
cout<<"Enter Roll: ";
cin>>roll1;
clrscr();
if (std==11)
{
goto strm1;
}
else if (std==12)
{
goto strm1;
}
else
{
goto stdin1;
}
strm1:
cout<<"Enter Stream: "<
cout<<"1] Medicine"<
cout<<"2] Engineering"<
cout<<"3] Commerce"<
cout<<"Enter a choice (1-3): ";
cin>>strm1;
if (strm1>3)
{
clrscr();
cout<<"You must enter a choice between 1 and 3\n";
getch();
goto strm1;
}
stdin1:
clrscr();
cout<<"Marks obtained for English: ";
cin>>eng1;
if (eng1>max)
{
cout<<"You must enter marks within the limit!\n";
getch();
goto stdin1;
}
sel1:
if (selopt==1)
{
clrscr();
cout<<"Marks obtained for secondary language: ";
cin>>sel1;
if (sel1>max)
{
cout<<"You must enter marks within the limit!\n";
getch();
goto sel1;
}
}
ss1:
clrscr();
if (std<11)
{
cout<<"Marks obtained for Social Science: ";
cin>>ss1;
if (ss1>max)
{
cout<<"You must enter marks within the limit!\n";
getch();
goto ss1;
}
}
it1:
clrscr();
if (std<=10)
{
cout<<"Marks obtained for Computer Science: ";
cin>>it1;
if (it1>max)
{
cout<<"You must enter marks within the limit!\n";
getch();
goto it1;
}
}
if (std>10)
{
if (strm1==1)
{
msci1:
clrscr();
cout<<"Marks obtained for Science (excluding Biology): ";
cin>>sci1;
if (sci1>max)
{
cout<<"You must enter marks within the limit!\n";
getch();
goto msci1;
}
}
if (strm1==2)
{
goto sci1;
}
if (strm1==3)
{
goto com1;
}
}
sci1: //pointing geeks to this place :)
clrscr();
cout<<"Marks obtained for Science ";
cin>>sci1;
if (sci1>max)
{
cout<<"You must enter marks within the limit!\n";
getch();
goto sci1;
}
math1:
clrscr();
cout<<"Marks obtained for Maths: ";
cin>>math1;
if (math1>max)
{
cout<<"You must enter marks within the limit!\n";
getch();
goto math1;
}
hsit1:
clrscr();
if (strm1==2) //custom input for seperate streams!
{
cout<<"Marks obtained for Computer Science: ";
cin>>it1;
if (it1>max)
{
cout<<"You must enter marks within the limit!\n";
getch();
goto hsit1;
}
}
med1:
clrscr();
if (strm1==2)
{
cout<<"Marks obtained for Biology: ";
cin>>bio1;
if (bio1>max)
{
cout<<"You must enter marks within the limit!\n";
getch();
goto med1;
}
}
com1: //Just a label, to direct commerce students away from the hassle of science!
clrscr();
if (strm1==3)
{
cout<<"Marks obtained for Commerce: ";
cin>>com1;
if (com1>max)
{
cout<<"You must enter marks within the limit!\n";
getch();
goto com1;
}
cit1:
clrscr();
cout<<"Marks obtained for Computer Science: ";
cin>>it1;
if (it1>max)
{
cout<<"You must enter marks within the limit!\n";
getch();
goto cit1;
}
}
hin1:
if (std<11)
{
clrscr();
cout<<"Marks obtained for Hindi: ";
cin>>hin1;
if (hin1>max)
{
cout<<"You must enter marks within the limit!\n";
getch();
goto hin1;
}
}
clrscr();
cout<<"Comparison data has succesfully been entered!\n";
cout<<"Please press Return to continue...";
getch();
goto menu;
}
if (opt==3)
{
clrscr();
cout<<"--Basic Info--------------------------------------------------------------------\n";
cout<<"First Name of Student - "<
cout<<"Last Name of Student - "<
cout<<"Standard - "<
cout<<"Division - "<
cout<<"Roll No. - "<
if (std>10)
{
cout<<"Stream - ";
if (strm==1)
{
cout<<"Medicine\n";
}
else if (strm==2)
{
cout<<"Engineering\n";
}
else if (strm==3)
{
cout<<"Commerce\n";
}
}
cout<
cout<<"--Marks-------------------------------------------------------------------------\n";
cout<<"English - "<
if (selopt==1)
{
cout<<"Secondary Language - "<
}
if (std<11 || strm==1 || strm==2)
{
cout<<"Science - "<
}
if (std<11)
{
goto coutit;
}
if (strm==2)
{
goto coutit;
}
if (strm==3)
{
goto coutit;
}
coutit:
cout<<"Computer Science - "<
if (strm==1)
{
cout<<"Biology - "<
}
if (strm==3)
{
cout<<"Commerce - "<
}
else
{
cout<<"Maths - "<
}
if (std<11)
{
cout<<"Social Science - "<
}
if (std<11)
{
cout<<"Hindi - "<
}
if (std<11)
{
tot=ss+sci+eng+sel+it+math+hin;
totp=(tot/(max*6))*100;
cout<<"Total Marks - "<
}
if (strm==1)
{
tot=eng+math+bio+sci+sel;
totp=(tot/(max*5))*100;
cout<<"Total Marks - "<
}
if (strm==2)
{
tot=eng+math+sci+it+sel;
totp=(tot/(max*5))*100;
cout<<"Total Marks - "<
}
if (strm==3)
{
tot=eng+sci+com+it+sel;
cout<<"Total Marks - "<
}
cout<
cout<<"--Graph-------------------------------------------------------------------------\n";
cout<<"English - [";
engp=(eng/max)*100;
gengval=engp/5;
for (int graphval=0;graphval
{
cout<<"=";
}
for (int lineval=0;lineval<20-graphval;++lineval)
{
cout<<" ";
}
cout<<"]"<
if (selopt==1)
{
cout<<"Secondary Language - [";
selp=(sel/max)*100;
gselval=selp/5;
for (int graphval1=0;graphval1
{
cout<<"=";
}
for (int lineval1=0;lineval1<20-graphval1;++lineval1)
{
cout<<" ";
}
cout<<"]"<
}
if (std<11 || strm!=3)
{
cout<<"Science - [";
scip=(sci/max)*100;
gscival=scip/5;
for (int graphval2=0;graphval2
{
cout<<"=";
}
for (int lineval2=0;lineval2<20-graphval2;++lineval2)
{
cout<<" ";
}
cout<<"]"<
}
if (strm==2 || strm==3 || std<11)
{
cout<<"Computer Science - [";
itp=(it/max)*100;
gitval=itp/5;
for (int graphval3=0;graphval3
{
cout<<"=";
}
for (int lineval3=0;lineval3<20-graphval3;++lineval3)
{
cout<<" ";
}
cout<<"]"<
}
if (strm==1)
{
cout<<"Biology - [";
biop=(bio/max)*100;
gbioval=biop/5;
for (int graphval4=0;graphval4
{
cout<<"=";
}
for (int lineval4=0;lineval4<20-graphval4;++lineval4)
{
cout<<" ";
}
cout<<"]"<
}
if (strm==3)
{
cout<<"Commerce - [";
comp=(com/max)*100;
gcomval=comp/5;
for (int graphval5=0;graphval5
{
cout<<"=";
}
for (int lineval5=0;lineval5<20-graphval5;++lineval5)
{
cout<<" ";
}
cout<<"]"<
}
if (strm==1 || strm==2 || std<11)
{
cout<<"Mathematics - [";
mathp=(math/max)*100;
gmathval=mathp/5;
for (int graphval6=0;graphval6
{
cout<<"=";
}
for (int lineval6=0;lineval6<20-graphval6;++lineval6)
{
cout<<" ";
}
cout<<"]"<
}
if (std<11)
{
cout<<"Social Science - [";
ssp=(ss/max)*100;
gssval=ssp/5;
for (int graphval7=0;graphval7
{
cout<<"=";
}
for (int lineval7=0;lineval7<20-graphval7;++lineval7)
{
cout<<" ";
}
cout<<"]"<
}
if (std<11)
{
cout<<"Hindi - [";
hinp=(hin/max)*100;
ghinval=hinp/5;
for (int graphval9=0;graphval9
{
cout<<"=";
}
for (int lineval9=0;lineval9<20-graphval9;++lineval9)
{
cout<<" ";
}
cout<<"]"<
}
cout<<"Total Marks - [";
gtotval=totp/5;
for (int graphval8=0;graphval8
{
cout<<"=";
}
for (int lineval8=0;lineval8<20-graphval8;++lineval8)
{
cout<<" ";
}
cout<<"]"<
}
}
No comments:
Post a Comment