Tera saroor Program#16
To calculate grades by entering obtained marks .
#include <iostream>
using namespace std;
int main()
int a , total=100;
cout<<"Enter your marks =a=";
cin>>a;
if (a<=49)
cout<<"Your grade is =F"<<endl;
else if (a>=50&&a<=54)
cout <<"Your grade is =D"<<endl;
else if (a>=55&&a<=59)
cout <<"Your grade is =D+"<<endl;
else if (a>=60&&a<=64)
cout<<"Your grade is =C-"<<endl;
else if (a>=65&&a<=69)
cout<<"Your grade is =C"<<endl;
else if (a>=70&&a<=74)
cout <<"Your grade is =C+"<<endl;
else if (a>=75&&a<=79)
cout <<"Your grade is =B"<<endl;
else if (a>=80&&a<=84)
cout <<"Your grade is =B+"<<endl;
else if (a>=85&&a<=89)
cout<<"Your grade is =A-"<<endl;
else if (a>90&&a<=100)
cout <<"Your grade is =A"<<endl;
else
Manual 4 Page 1
cout <<"Enter valid marks"<<endl;
system ("pause");
return 0;}
Program#17
To calculate the driving cost of one day.
#include <iostream>
using namespace std;
int main()
int coog,tpd,pf;
float gu , mile ,ampg,coopd,tcpd;
cout <<"Enter mile driven per day=";
cin>>mile;
cout <<"Average mile per gallon=";
cin>>ampg;
cout <<"Enter cost of one gallon=";
cin>>coog;
cout<<"Tolls per day in Rs=";
cin>>tpd;
cout<<"Enter parking fees=";
cin>>pf;
gu=mile/ampg;
cout<<gu;
coopd=gu*coog;
tcpd=coopd+tpd+pf;
cout <<"Total cost per day="<<tcpd<<endl;
return 0;}
Program#18
To check if the person is eligible for insurance or not.
Manual 4 Page 2
#include <iostream>
using namespace std;
int main()
int age ;
char gender, ms;
cout<<"Enter your age=";
cin>>age;
cout <<"Enter m for married and u for unmarried=";
cin>>ms;
cout <<"Enter M for male and F for female=";
cin>>gender;
if (ms=='m')
cout<<"He Or She is eligible for insurance"<<endl;
else if (ms=='u'&&gender=='M'&&age>30)
cout <<"He is eligible for insurance"<<endl;
else if (ms=='u'&&gender=='F'&&age>25)
cout <<"She is eligible for insurance"<<endl;
else
cout <<"Not eligible for insurance"<<endl;
return 0;}
Program#19
To calculate fine charged by library if the book is returned late.
#include <iostream>
using namespace std;
int main()
int x;
cout <<"Enter the number of days to be late=";
cin>>x;
Manual 4 Page 3
if (x<=5)
cout<<"Fine carged is =50 Rs"<<endl;
else if (x>5&&x<=10)
cout<<"Fine chargrd is =100 Rs"<<endl;
else if (x>10&&x<=30)
cout <<"Fine charged is =200 Rs"<<endl;
else if (x>30)
cout<<"Fine charged is =200 Rs and Membership is also canceled"<<endl;
return 0;}
Program#20
To calculate the salary of an employ.
#include <iostream>
using namespace std;
int main()
int yos;
char gender , qal;
cout <<"Enter m for male and f for female=";
cin>>gender;
cout <<"Enter p for post graduate and g for graduate=";
cin>>qal;
cout <<"Enter year of service=";
cin>>yos;
if(gender=='m'&&qal=='p'&&yos>=10)
cout <<"Salery is 1500"<<endl;
if(gender=='m'&&qal=='g'&&yos>=10)
cout <<"Salery is 1200"<<endl;
if(gender=='m'&&qal=='p'&&yos<10)
cout <<"Salery is 1000"<<endl;
if(gender=='m'&&qal=='g'&&yos<10)
Manual 4 Page 4
cout <<"Salery is 700"<<endl;
if(gender=='f'&&qal=='p'&&yos>=10)
cout <<"Salery is 1200"<<endl;
if(gender=='f'&&qal=='g'&&yos>=10)
cout <<"Salery is 1000"<<endl;
if(gender=='f'&&qal=='p'&&yos<10)
cout <<"Salery is 700"<<endl;
if(gender=='f'&&qal=='g'&&yos<10)
cout <<"Salery is 600"<<endl;
system ("pause");
return 0;
Manual 4 Page 5