Wednesday 25 December 2013

Grading Program -Using C++ Language

#include<stdio.h>
#include<conio.h>
void main()
{
 int marks;
 clrscr();
 printf("Enter ur Marks");
 scanf("%d",&marks);
 if(marks>90)
 printf("Your grade is A");
 else if(marks>=80)
 printf("ur grade is B");
 else if(marks>=70)
 printf("ur grade is C");
 else if(marks>=60)
 printf("ur grade is D");
 else if(marks>=50)
 printf("ur grade is E");
 else if(marks<=50)
 printf("ur grde is F");
 getch();
 }

Air Line Ticket Booking Program- Using C++ Language

#include<conio.h>
#include<iostream.h>
class air_line
{
private:
char name[3][100];
long double opt,passport[3],cnic[3],ticket_number[3],ticket_number1,seats_num;
int opt1,seat_type;
public:
void phool_bootey_start()
{
cout<<"================================================================================";
cout<<"\t\t\tWelcome to Google Airlines \n";
cout<<"================================================================================";
}
void input()

{
for(int i=1;i<=2;i++)
{
cout<<"\n";
cout<<"Please Enter Your Name : ";
cin>>name[i];
cout<<"Please Enter Your Passport Number : ";
cin>>passport[i];
cout<<"Please Enter Your Cnic Number : ";
cin>>cnic[i];
cout<<"Please Enter Your Ticket Number : ";
cin>>ticket_number[i];
}
}
void process()
{
cout<<"Enter your option  \n 1.Fare  \n 2.Ticket Confirmation \n3.Ticket Registeration\n";
cin>>opt;
if(opt==1)
{
cout<<"\nSelect Journey \n 1.Pakistan\n 2.Abroad \n";
cin>>opt1;
switch(opt1)
{
case 1:
cout<<"\nSelect Seat Type \n1.Economy\n2.Business\n3.Upper Business\n";
cin>>seat_type;
if(seat_type==1)
{
cout<<"\n********************** FARES FOR PAKISTAN 09 JUNE 2013 ************************";
cout<<"\n\n ";
cout<<"Departure \t Timings\t Arrival \t Timings \t Fare \n ";
cout<<"\n Islmabad \t 05:00 AM \t Lahore \t 05:30 AM \t 10500 PKR";
cout<<"\n Islmabad \t 09:00 AM \t Karachi \t 11:30 AM \t 20000 PKR";
cout<<"\n Islmabad \t 01:00 PM \t Peshawar \t 02:30 PM \t 10000 PKR";
cout<<"\n Islmabad \t 05:00 PM \t Quetta \t 07:00 PM \t 25000 PKR";
cout<<"\n Islmabad \t 11:00 PM \t Sialkot \t 12:30 PM \t 55000 PKR ";
}
if(seat_type==2)
{
cout<<"\n********************** FARES FOR PAKISTAN 09 JUNE 2013 ************************";
cout<<"\n\n ";
cout<<"Departure \t Timings\t Arrival \t Timings \t Fare \n ";
cout<<"\n Islmabad \t 05:00 AM \t Lahore \t 05:30 AM \t 12100 PKR";
cout<<"\n Islmabad \t 09:00 AM \t Karachi \t 11:30 AM \t 30000 PKR";
cout<<"\n Islmabad \t 01:00 PM \t Peshawar \t 02:30 PM \t 20000 PKR";
cout<<"\n Islmabad \t 05:00 PM \t Quetta \t 07:00 PM \t 35000 PKR";
cout<<"\n Islmabad \t 11:00 PM \t Sialkot \t 12:30 PM \t 45000 PKR ";
}
if(seat_type==3)
{
cout<<"\n********************** FARES FOR PAKISTAN 09 JUNE 2013 ************************";
cout<<"\n\n ";
cout<<"Departure \t Timings\t Arrival \t Timings \t Fare \n ";
cout<<"\n Islmabad \t 05:00 AM \t Lahore \t 05:30 AM \t 20500 PKR";
cout<<"\n Islmabad \t 09:00 AM \t Karachi \t 11:30 AM \t 40000 PKR";
cout<<"\n Islmabad \t 01:00 PM \t Peshawar \t 02:30 PM \t 50000 PKR";
cout<<"\n Islmabad \t 05:00 PM \t Quetta \t 07:00 PM \t 65000 PKR";
cout<<"\n Islmabad \t 11:00 PM \t Sialkot \t 12:30 PM \t 75000 PKR ";
}
break;
case 2:
cout<<"\nSelect Seat Type \n1.Economy\n2.Business\n3.Upper Business\n";
cin>>seat_type;
if(seat_type==1)
{
cout<<"\n*********************** Fares FOR ABROAD 09 JUNE 2013 *************************";
cout<<"\n\n ";
cout<<"Departure \t Timings\t Arrival \t Timings \t Fare \n ";
cout<"Islmabad \t 05:00 AM \t Dubai UAE \t 24000 PKR";
cout<<"\n Islmabad \t 09:00 AM \t Wishington \t 03:00 PM \t 70000 PKR";
cout<<"\n Islmabad \t 01:00 PM \t California \t 01:00 AM \t 82000 PKR";
cout<<"\n Islmabad \t 05:00 PM \t Beijing \t 08:00 PM \t 30000 PKR";
cout<<"\n Islmabad \t 11:00 PM \t Tehran \t 04:00 PM \t 17000 PKR ";
}
if(seat_type==2)
{
cout<<"\n*********************** Fares FOR ABROAD 09 JUNE 2013 *************************";
cout<<"\n\n ";
cout<<"Departure \t Timings\t Arrival \t Timings \t Fare \n ";
cout<"Islmabad \t 05:00 AM \t Dubai UAE \t 34000 PKR";
cout<<"\n Islmabad \t 09:00 AM \t Wishington \t 03:00 PM \t 40000 PKR";
cout<<"\n Islmabad \t 01:00 PM \t California \t 01:00 AM \t 52000 PKR";
cout<<"\n Islmabad \t 05:00 PM \t Beijing \t 08:00 PM \t 50000 PKR";
cout<<"\n Islmabad \t 11:00 PM \t Tehran \t 04:00 PM \t 67000 PKR ";
}
if(seat_type==3)
{
cout<<"\n*********************** Fares FOR ABROAD 09 JUNE 2013 *************************";
cout<<"\n\n ";
cout<<"Departure \t Timings\t Arrival \t Timings \t Fare \n ";
cout<"Islmabad \t 05:00 AM \t Dubai UAE \t 24000 PKR";
cout<<"\n Islmabad \t 09:00 AM \t Wishington \t 03:00 PM \t 90000 PKR";
cout<<"\n Islmabad \t 01:00 PM \t California \t 01:00 AM \t 92000 PKR";
cout<<"\n Islmabad \t 05:00 PM \t Beijing \t 08:00 PM \t 90000 PKR";
cout<<"\n Islmabad \t 11:00 PM \t Tehran \t 04:00 PM \t 99000 PKR ";
}
break;
default:
cout<<"Wrong Statement Entered";
}
}
else if(opt==2)
{
cout<<"\n Please Enter Your Ticket Number : ";
cin>>ticket_number1;
for (int i=1;i<=5;i++)
{
if(ticket_number1==ticket_number[i])
{
cout<<"\n Your Seat is Confirmed ";
cout<<"\n Your Cnic Number is : "<<cnic[i];
cout<<"\n Passport No. :"<<passport[i];
}
}}
else if(opt==3)
{
cout<<"\nSelect Seat Type \n1.Economy\n2.Business\n3.Upper Business\n";
cin>>seat_type;
switch(seat_type)
{
case 1:
cout<<"How may Seats you want to Buy ? ";
cin>>seats_num;
cout<<"Purchase Done Successfully . Reamining Seats are "<<100-seats_num;
break;
case 2:
cout<<"How may Seats you want to Buy ? ";
cin>>seats_num;
cout<<"Purchase Done Successfully . Reamining Seats are "<<100-seats_num;
break;
case 3:
cout<<"How may Seats you want to Buy ? ";
cin>>seats_num;
cout<<"Purchase Done Successfully . Reamining Seats are "<<100-seats_num;
default:
cout<<"Wrong Statement Entered";
}
}

else
cout<<"Wrong Statement Entered";
}

void phool_bootey_end()
{
cout<<"\n\n================================================================================";
cout<<"\t:)Thanks for Visiting Google Airlines - Have a Safe Journey :)\n";
cout<<"================================================================================";
}
};
main()
{
clrscr();
air_line google;
google.phool_bootey_start();
google.input();
google.process();
google.phool_bootey_end();
getch();
}


Saturday 31 August 2013

Program Over Flow- Using C++ Language

#include<iostream.h>
#include<conio.h>
class Distance{
private:
int feet;
int inches;
public:
Distance(){
feet=0;
inches=0;
}
Distance(int f, int i)
{
feet=f;
inches=i;
}
void display()
{
cout<<"f:"<<feet <<"i:"<<inches;
}
Distance operator--()
{
feet=--feet;
inches=--inches;
return Distance(feet,inches);
}

};
void main(void)
{

Distance D1(11,10);
//Distance D(-10,-12);
--D1;
D1.display();

//D.display();
getch();
}

Program Electricity Bill in C++ Language

#include<iostream.h>
#include<conio.h>
class bill{ public:
char name;
int units;
float tbill;
float tbill1,tbill2,tbill3;
void input(){

cout<<"Enter the name:\t";
cin>>name;
cout<<"Enter the units:\t";
cin>>units;
}
void output()
{
switch(units)
{
case 100:
{tbill1=units*0.6;
cout<<"Total bill=\t"<<tbill1;
}
case 200:
{tbill2=units*0.8;
cout<<"Total bill:\t"<<tbill2;
}
case 300:
{tbill3=units*0.9;
cout<<"Total bill:\t"<<tbill3;
}

float tbill()
 {
 return tbill1+tbill2+tbill3;
  }
}}
};
void main(void)
{
bill n;

n.input();
n.output();
tbill=n.tbill;

cout<<"Over all bill:\t"<<tbill;
getch();
}