Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
C++ Exercises - 1 - Air Ticket (By ၿငိမ္းၿငိမ္း ျမတ္)
#1
Code:
#include<iostream>
using namespace std;
int main()
{
   int n,i,p,b,c;
   char ch,chr;
   p=0;
   c=0;
   cout <<"enter your desire number of tickets";
   cin>>n;
   for(i=0;i<n;i++)
   {
       cout<<"enter time morning 'm' or afternoon 'a' night'N'";
       cin>>ch;
       cout<<"enter class 'e' or 'f'";
       cin>>chr;
       if(ch=='m' && chr=='e')
           p=100;
       else if (ch=='m' && chr=='f')
           p=150;
       else if(ch=='a' && chr=='e')
           p=90;
       else if(ch=='a' && chr=='f')
           p=140;
       else if(ch=='N' && chr=='e')
           p=70;
       else p=120;
           c=c+p;
   }
   if(n>2)
   {
       b=(c/100)*15;
       c=c-b;
   }
   cout<<"cost is. "<<c;
   return 0;
   }
Reply


[-]
Quick Reply
Message
Type your reply to this message here.

Image Verification
Please enter the text contained within the image into the text box below it. This process is used to prevent automated spam bots.
Image Verification
(case insensitive)

Forum Jump:


Users browsing this thread: 1 Guest(s)