Monday, March 28, 2011

Exercise 2











#include <iostream.h>
main()
{
      //declare
      float cgpa,total,total2;
      char a;
      //input
      cout<<"Please enter your CGPA:"<<endl;
      cin>>cgpa;
      if (cgpa == 4.00)
      {total = (1)*16000;
      total2 = 16000 - total;}
      else if (3.00<=cgpa<=3.99)
      {total = (0.8)*16000;
      total2 = 16000 - total;}
      else if (2.00<=cgpa<=2.99)
      {total = (0.4)*16000;
      total2 = 16000 - total;}
      else if (0<=cgpa<=1.99)
      {total = (0)*16000;
      total2 = 16000 - total;}
      else {cout<<"Invalid CGPA";}
      //output
      cout<<"Your CGPA is "<<cgpa<<endl;
      cout<<"Your Discount "<<total<<endl;
      cout<<"You have to pay "<<total2;
      cout<<"\n\nType quit to exit application"<<endl;
      cin>>a;
      return 0;
      }
    

No comments:

Post a Comment