Jump to content

chitrangda

Senior Members
  • Posts

    268
  • Joined

  • Last visited

Posts posted by chitrangda

  1. I'm giving exams for admission in collages.I'm not able to decide whether i should go for collages offering masters in science(Msc.) or bachelor's of technology. I want to take up astrophysics as my career, so which one will be a better way to reach my destination?:confused:

  2. instead of searching online if you try to concentrate a bit that can give you answers...i think all are easy but i dint get the last one.and if you are not able to get them just rewrite the keywords on Google...i tried you get answers that way also;)

  3. my complete program now works(though i worked on it in tits and bits!)

    #include<iostream.h>
    #include<conio.h>
    #include<stdio.h>
    #include<process.h>
    #include<fstream.h>
    #include<string.h>
    int ad=0,ch=0,a2,flight,flag=0,tage,tticketno=200;
    char tname[30];
    class airline
    {
     char name[30];
     int age;
     unsigned long int basic,fuel,travelling,total;
     char flightname[30],flightno[30];
     char orgin[30],destination[30],tclass[20];
    
     public:
       int dd,mm,yyyy,ticketno;
       void datainput();
       void dataprocessing();
       void datadisplay();
       void menu();
       void findlastticketno();
       void ticketcancel();
    } item;
    
    struct date
    {
     int day_no;
     int month;
     int year;
    } d1;
    
    void airline::menu()
    {
     clrscr();
     cout<<"WELCOME TO CIS RESERVATION CENTER\n";
     cout<<"\n MENU\n";
     cout<<"1: TICKET BOOKING\n";
     cout<<"2: TICKET PRINTING\n";
     cout<<"3. TICKET CANCELLING\n";
     cout<<"4: EXIT\n";
    }
    
    class flight
    {
     public:
       void routes();
       void available();
       void domestic();
       void dateflagchecking();
       void feeclass();
    } f1;
    
    void flight::routes()
    {
     cout<<"\n";
     cout<<"Ticket Booking\n";
     cout<<"Available Destinations\n";
     cout<<"1 : INDIA TO BANGKOK"   <<"\t"<<"11: INDIA TO LONDON"      <<"\n";
     cout<<"2 : INDIA TO DUBAI"     <<"\t"<<"12: NEW YORK TO INDIA"   <<"\n";
     cout<<"3 : DELHI TO MUMBAI "   <<"\t"<<"13: HYDERABAD TO CHENNAI"<<"\n";
     cout<<"4 : BANGKOK TO INDIA"   <<"\t"<<"14: CHENNAI TO MUMBAI"   <<"\n";
     cout<<"5 : MALAYSIA TO INDIAt" <<"\t"<<"15: DELHI TO CHENNAI"    <<"\n";
     cout<<"6 : INDIA TO NEW YORK"  <<"\t"<<"16: CHENNAI TO HYDERABAD"<<"\n";
     cout<<"7 : MUMBAI TO CHENNAI"  <<"\t"<<"17: INDIA TO MALAYSIA"   <<"\n";
     cout<<"8 : DUBAI TO INDIA"     <<"\t"<<"18: HYDERABAD TO MUMBAI" <<"\n";
     cout<<"9 : MUMBAI TO HYDERABAD"<<"\t"<<"19: CHENNAI TO DELHI"    <<"\n";
     cout<<"10: MUMBAI TO DELHI"    <<"\t"<<"20: LONDON TO INDIA"     <<"\n";
    }
    
    void flight::available()
    {
     cout<<"FLIGHTS AVAILABLE FOR INTERNATIONAL DESTINATIONS\n";
    
     cout<<"Flight Name"   <<"\t"<<"Flight NO."<<"\n";
     cout<<"1: Air India"  <<"\t"<<"AI 2535"   <<"\n";
     cout<<"2: JetAirways" <<"\t"<<"JA 4685"   <<"\n";
     cout<<"3: Kingfisher" <<"\t"<<"KF 2498"   <<"\n";
     cout<<"4: AirIndia"   <<"\t"<<"AI 0787"   <<"\n";
     cout<<"5: KIngfisher" <<"\t"<<"KF 3245"   <<"\n";
     cout<<"6: Jet Airways"<<"\t"<<"JA 1868"   <<"\n";
    }
    
    void flight::domestic()
    {
     cout<<"FLIGHTS AVAILABLE FOR DOMESTIC DESTINATIONS\n";
    
     cout<<"Flight Name"         <<"\t"<<"Flight NO."<<"\n";
     cout<<"1: Indian Airlines"  <<"\t"<<"IA 2538"   <<"\n";
     cout<<"2: Spicejet"         <<"\t"<<"SJ 5736"   <<"\n";
     cout<<"3: JetAirways"       <<"\t"<<"JA 4485"   <<"\n";
     cout<<"4: Kingfisher"       <<"\t"<<"KF 8498"   <<"\n";
     cout<<"5: Air Deccan"       <<"\t"<<"AD 3517"   <<"\n";
     cout<<"6: Indian Airlines"  <<"\t"<<"IA 0797"   <<"\n";
     cout<<"7: KIngfisher"       <<"\t"<<"KF 3545"   <<"\n";
     cout<<"8: Air Deccan"       <<"\t"<<"AD 1379"   <<"\n";
     cout<<"9: Jet Airways"      <<"\t"<<"JA 1808"   <<"\n";
     cout<<"10:Spicejet"         <<"\t"<<"SJ 2564"   <<"\n";
    }
    
    void flight::feeclass()
    {
     cout<<"Please enter in class which do you want to sit\n";
    
     cout<<"1: First Class\n";
     cout<<"2: Economy Class\n";
     cout<<"3: Executive class\n";
    }
    
    void flight::dateflagchecking()
    {
    do
     {
     flag=0;
     cout<<"Please enter the date you are  boarding the plane\n";
    
     cout<<"Date"<<"\t";
     cin>>d1.day_no;
     if(d1.day_no<=31)
     {
       cout<<"\n";
       cout<<"Month"<<"\t";
       cin>>d1.month;
       if(d1.month<=12)
       {
         cout<<"\n";
         cout<<"Year"<<"\t";
         cin>>d1.year;
         if(d1.year==2008)
         {
    flag=1;
    item.dd=d1.day_no;
    item.mm=d1.month;
    item.yyyy=d1.year;
         }
         }
         }
    else
         {
    flag=0;
    cout<<"\nInvalid Date ... \nRetry again...";
    }
    }
    
    while(flag!=1);
    }
    
    void airline::datainput()
    {
    
     if (flag==1)
     {
       cout<<"\nName    ";
       gets(tname);
       cout<<"\nAge     ";
       cin>>tage;
       strcpy(item.name,tname);
       item.age=tage;
     }
    }
    
    void airline::dataprocessing()
    {
     int c;
    
     basic=0;
     fuel=0;
     travelling=0;
     total=0;
     strcpy(flightname,"");
     strcpy(flightno,"");
     strcpy(orgin,"");
     strcpy(destination,"");
    
      if(a2==1||a2==2||a2==4||a2==5||a2==6||a2==8||a2==11||a2==12||a2==17||a2==20)
    
     {
       f1.available();
       cout<<"Please enter your choice\n";
       cin>>flight;
       if (flight==1) strcpy(flightname," Air India"), strcpy(flightno,"AI 2535");
       if (flight==2) strcpy(flightname," JetAirways"), strcpy(flightno,"JA 4685");
       if (flight==3) strcpy(flightname," Kingfisher"), strcpy(flightno,"KF 2498");
       if (flight==4) strcpy(flightname," AirIndia"), strcpy(flightno,"AI 0787");
       if (flight==5) strcpy(flightname," Kingfisher"), strcpy(flightno,"KF 3245");
       if (flight==6) strcpy(flightname," Jet Airways"), strcpy(flightno,"JA 1868");
    
       f1.feeclass();
       cout<<"Please enter your choice\n";
       cin>>c;
       if (c==1) strcpy(tclass,"First");
       if (c==2) strcpy(tclass,"Economy");
       if (c==3) strcpy(tclass,"Executive");
       switch(c)
       {
         case 1:
         if(a2==1||a2==4)
    fuel=18000;
         else if(a2==2||a2==8)
    fuel=16000;
         else if(a2==5||a2==17)
    fuel=14000;
         else if(a2==6||a2==12)
    fuel=32000;
         else if(a2==11||a2==20)
    fuel=26000;
         basic=12000;
         cout<<"\nTotal Cost=\n";
         cout<<"\nBasic Fare="<<basic;
         cout<<"\nFuel charges=Rs"<<fuel;
         travelling=15000;
         cout<<"\nTravelling Charges="<<travelling;
         total=12000+15000+fuel+(8000*ad)+(5000*ch);
         cout<<"\nTotal Charges = Rs."<<total;
         break;
    
         case 2:
         if(a2==1||a2==4)
    fuel=20000;
         else if(a2==2||a2==8)
    fuel=18000;
         else if(a2==5||a2==17)
    fuel=16000;
         else if(a2==6||a2==12)
    fuel=34000;
         else if(a2==11||a2==20)
    fuel=28000;
         cout<<"\nTotal Cost=\n";
         basic=14000;
         cout<<"\nBasic Fare=Rs"<<basic;
         cout<<"\nFuel charges=Rs";
         cout<<fuel;
         travelling=17000;
         cout<<"\nTravelling Charges=Rs."<<travelling;
         total=14000+17000+fuel+(10000*ad)+(7000*ch);
         cout<<"\nTotal Charges = Rs."<<total;
         break;
    
         case 3:
         if(a2==1||a2==4)
    fuel=22000;
         else if(a2==2||a2==8)
    fuel=20000;
         else if(a2==5||a2==17)
    fuel=18000;
         else if(a2==6||a2==12)
    fuel=36000;
         else if(a2==11||a2==20)
    fuel=30000;
         cout<<"\nTotal Cost\n";
         basic=16000;
         cout<<"\nBasic Fare=Rs "<<basic;
         cout<<"\nFuel charges=Rs "<<fuel;
         travelling=19000;
         cout<<"\nTravelling Charges=Rs."<<travelling;
         total=16000+19000+fuel+(12000*ad)+(9000*ch);
         cout<<"\nTotal Charges = Rs."<<total;
         break;
       }
     }
     else
     {
       f1.domestic();
       cout<<"\nPlease enter your choice ";
       cin>>flight;
    
       if (flight==1) strcpy(flightname,"Indian Airlines"), strcpy(flightno,"IA 2538");
       if (flight==2) strcpy(flightname,"2: Spicejet"), strcpy(flightno, "SJ 5736");
       if (flight==3) strcpy(flightname,"3: JetAirways"), strcpy(flightno, "JA 4485");
       if (flight==4) strcpy(flightname,"4: Kingfisher"), strcpy(flightno, "KF 8498");
       if (flight==5) strcpy(flightname,"5: Air Deccan"), strcpy(flightno, "AD 3517");
       if (flight==6) strcpy(flightname,"6: Indian Airlines"), strcpy(flightno, "IA 0797");
       if (flight==7) strcpy(flightname,"7: KIngfisher"), strcpy(flightno, "KF 3545");
       if (flight==8) strcpy(flightname,"8: Air Deccan"), strcpy(flightno, "AD 1379");
       if (flight==9) strcpy(flightname,"9: Jet Airways"), strcpy(flightno, "JA 1808");
       if (flight==10) strcpy(flightname,"10:Spicejet"), strcpy(flightno, "SJ 2564");
    
       f1.feeclass();
       cout<<"\nPlease enter your choice\n";
       cin>>c;
       if (c==1) strcpy(tclass,"First");
       if (c==2) strcpy(tclass,"Economy");
       if (c==3) strcpy(tclass,"Executive");
    
       switch(c)
       {
         case 1:
         if(a2==3||a2==10)
    fuel=1800;
         else if(a2==7||a2==14)
    fuel=1600;
         else if(a2==9||a2==18)
    fuel=1400;
         else if(a2==13||a2==16)
    fuel=3200;
         else if(a2==15||a2==19)
    fuel=2600;
         cout<<"\nTotal Cost\n";
         basic=1200;
         cout<<"\nBasic Fare=Rs "<<basic;
         cout<<"\nFuel charges=Rs "<<fuel;
         travelling=1500;
         cout<<"\nTravelling Charges=Rs "<<travelling;
         total=1200+1500+fuel+(800*ad)+(500*ch);
         cout<<"\nTotal Charges = Rs."<<total;
         break;
    
         case 2:
         if(a2==3||a2==10)
    fuel=2000;
         else if(a2==7||a2==14)
    fuel=1800;
         else if(a2==9||a2==18)
    fuel=1600;
         else if(a2==13||a2==16)
    fuel=3400;
         else if(a2==15||a2==19)
    fuel=2800;
         cout<<"\nTotal Cost=\n";
         basic=1400;
         cout<<"\nBasic Fare=Rs "<<basic;
         cout<<"\nFuel charges=Rs "<<fuel;
         travelling=1700;
         cout<<"\nTravelling Charges=Rs "<<travelling;
         total=1400+1700+fuel+(1000*ad)+(700*ch);
         cout<<"\nTotal Charges = Rs."<<total;
         break;
    
         case 3:
         if(a2==3||a2==10)
    fuel=2200;
         else if(a2==7||a2==14)
    fuel=2000;
         else if(a2==9||a2==18)
    fuel=1800;
         else if(a2==13||a2==16)
    fuel=3600;
         else if(a2==15||a2==19)
    fuel=3000;
         cout<<"\nTotal Cost=\n";
         basic=1600;
         cout<<"\nBasic Fare=Rs "<<basic;
         cout<<"\nFuel charges=Rs "<<fuel;
         travelling=1900;
         cout<<"\nTravelling Charges=Rs "<<travelling;
         total=1600+1900+fuel+(1200*ad)+(900*ch);
         cout<<"\nTotal Charges = Rs."<<total;
         break;
       }
     }
     if (a2==1) strcpy(orgin,": INDIA"), strcpy(destination,"BANGKOK");
     if (a2==11) strcpy(orgin,": INDIA"), strcpy(destination,"LONDON");
     if (a2==2) strcpy(orgin,": INDIA"), strcpy(destination,"DUBAI");
     if (a2==12) strcpy(orgin,": NEW YORK"),strcpy(destination,"INDIA");
     if (a2==3) strcpy(orgin,": DELHI"), strcpy(destination,"MUMBAI ");
     if (a2==13) strcpy(orgin,": HYDERABAD"),strcpy(destination,"CHENNAI");
     if (a2==4) strcpy(orgin,": BANGKOK"),strcpy(destination,"INDIA");
     if (a2==14) strcpy(orgin,": CHENNAI"),strcpy(destination,"MUMBAI");
     if (a2==5) strcpy(orgin,": MALAYSIA"),strcpy(destination,"INDIA");
     if (a2==15) strcpy(orgin,": DELHI"),strcpy(destination,"CHENNAI");
     if (a2==6) strcpy(orgin,": INDIA"),strcpy(destination,"NEW YORK");
     if (a2==16) strcpy(orgin,": CHENNAI"),strcpy(destination,"HYDERABAD");
     if (a2==7) strcpy(orgin,": MUMBAI"),strcpy(destination,"CHENNAI");
     if (a2==17) strcpy(orgin,": INDIA"),strcpy(destination, "MALAYSIA");
     if (a2==8) strcpy(orgin,": DUBAI"),strcpy(destination,  "INDIA");
     if (a2==18) strcpy(orgin,": HYDERABAD"),strcpy(destination, " MUMBAI");
     if (a2==9) strcpy(orgin,": MUMBAI "),strcpy(destination, "HYDERABAD");
     if (a2==19) strcpy(orgin,": CHENNAI"),strcpy(destination, "DELHI");
     if (a2==10) strcpy(orgin,": MUMBAI"),strcpy(destination, "DELHI");
     if (a2==20) strcpy(orgin,": LONDON"),strcpy(destination, "INDIA");
     ticketno++;
     item.ticketno=ticketno;
    }
    
    void airline::datadisplay()
    {
     int p;
     cout<<"\n-------------------------------------------------------";
     cout<<"\nticket no."<<"\t"<<ticketno;
    
     cout<<"\nFlight name: "<<flightname;
     cout<<"\tFlight no. : "<<flightno;
    
     cout<<"\nOrigin: "<<orgin;
     cout<<"\tDestination: "<<destination;
    
     cout<<"\nName :"<<name;
     cout<<"\tAge  :"<<age;
    
     cout<<"\nday "<<dd;
     cout<<" month "<<mm;
     cout<<" year  "<<yyyy;
     cout<<" --- Class "<<tclass;
    
     cout<<"\nBasic Rs. "<<item.basic;
     cout<<"\tFuel Rs. "<<item.fuel;
     cout<<"\tTravelling Rs. "<<item.travelling;
     cout<<"\tTotal Rs. "<<item.total;
     cout<<"\n**Happy Journey**(Note:Charges depend on Class in which U Travel:-)";
     tage=item.age;
    
    }
    
    void airline::findlastticketno()
    {
     fstream filfltn;
     filfltn.open("airline.dat",ios::in);
     filfltn.seekg(0,ios::beg);
     do
     {
       if (!filfltn.fail())
       {
         if (!filfltn.eof())
         {
    filfltn.read((char*)&item,sizeof(airline));
    tticketno=item.ticketno;
         }
       }
       else
       {
         tticketno=200;
         item.ticketno=tticketno;
         /*cout<<"\n File is Empty..."; */
         break;
       }
     }
     while(!filfltn.eof());
     filfltn.close();
    }
    void airline::ticketcancel()
    {
     fstream tfilin;
     fstream filin;
     filin.open("airline.dat",ios::in);
     tfilin.open("tairline.dat",ios::out);
     filin.seekg(0,ios::beg);
    
     cout<<"\nEnter the TICKET NO. to Cancel :-";
     cin>>tticketno;
     flag=0;
    
     while (!filin.eof())
     {
       if (!filin.fail())
       {
         filin.read((char*)&item,sizeof(airline));
         if (!filin.eof())
         {
    if (item.ticketno==tticketno)
    {
      flag=1;
      cout<<"\n TICKET No Exist.... Details are:-";
      item.datadisplay();
      cout<<"\n TICKET No. Has been CANCELLED...";
    }
    else
      tfilin.write((char*)&item,sizeof(airline));
         }
         else
         break;
       }
       else
       {
         cout<<"\n File Fail to open...";
         cout<<"\n File is Empty...";
         break;
       }
     }
     filin.close();
     tfilin.close();
    
     if (flag==1)
     {
       filin.open("airline.dat",ios::out);
       tfilin.open("tairline.dat",ios::in);
       tfilin.seekg(0,ios::beg);
    
       while (!tfilin.eof())
       {
         if (!tfilin.fail())
         {
    tfilin.read((char*)&item,sizeof(airline));
    if (!tfilin.eof())
      filin.write((char*)&item,sizeof(airline));
    else
      break;
         }
       }
     }
     else
       cout<<"\n Sorry TICKET No. Does Not Exits...";
     tfilin.close();
     filin.close();
    }
    
    
    void main()
    {
     int c,p;
     char choice;
     clrscr();
     do
     {
       item.menu();
       cout<<"Enter your choice\n";
       cin>>c;
    
       switch(c)
       {
         case 1:
    cout<<"\n";
    cout<<"\nPlease enter the no. of persons boarding\n";
    cin>>p;
    if(p>200)
    {
      cout<<"\nSorry!seats are not available\n";
      cout<<"\nPlease book in other classes";
      break;
    }
    item.findlastticketno();
    fstream filin;
    filin.open("airline.dat",ios::app);
    while(p!=0)
    {
      f1.routes();
      cout<<"Please enter the code no. of the routes\n";
      cin>>a2;
      f1.dateflagchecking();
    
      cout<<"\n";
      item.datainput();
      item.dataprocessing();
      filin.write((char*)&item,sizeof(airline));
      p--;
    }
    filin.close();
    break;
         case 2:
    ch=0,ad=0;
    fstream filre;
    filre.open("airline.dat",ios::in);
    filre.seekg(0,ios::beg);
    while (!filre.eof())
    {
      if (!filre.fail())
      {
          filre.read((char*)&item,sizeof(airline));
          if (!filre.eof())
          {
    	item.datadisplay();
    	if (tage<=12)
    	  ch++;
    	else
    	  ad++;
          }
      }
      else
      {
        cout<<"\n File Fail to open...";
        cout<<"\n File is Empty...";
        break;
      }
    }
    filre.close();
    break;
         case 3:
    item.ticketcancel();
    break;
         case 4:
    exit(0);
       }
       cout<<"\nDo U Want to Continue.... Enter[Y][y] or [N][n]: ";
       cin>>choice;
     }
     while(choice=='y'||choice=='Y');
     cout<<"\nNo. of persons boarding"<<"\t"<<ad+ch;
     cout<<"\nadults   :"<<ad;
     cout<<"\tchildren :"<<ch;
     getch();
    }
    

  4. i made few videos of my school function in my mobile and then trasfered them to my computer.I wish to edit them.i also wanted to join few videos.

    can anyone tell me about any sofware which can do this and how to use that software.

  5. code:

    #include<iostream.h>
    #include<conio.h>
    void main()
    {
    int date();
    int d;
    int data;
    cout<<"enter the date";
    cin>>d;
    data=date();
    getch();
    }
    date(int d)
    { static int f=1;
    if(d>31)
    {
    cout<<"enter a valid date";
    date(d);
    }
    return f;
    }
    

    i wanted that function date should be called again and again until and unless proper condition is saticified.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.