Saturday, April 16, 2011

Re: [discussion_vu] CS 2O1 First Assignment Solution

Assalam mu Alikum brother!
 
                                         nice work I just want to know the following only for my sake.
                                         I want to what is the function the number char name[20];
      char carNo[10];
inside the braces like (20) and (10) cant we jsut declare the variables without these number,,, and other thing what is that "\t" you have used in character string, why u have used that.


On Sat, Apr 16, 2011 at 7:17 PM, CoooL <asad.coool786@gmail.com> wrote:


---------- Forwarded message ----------
From: Talha



CS 2O1 First Assignment Solution

#include<iostream.h>

int amount(char, int);

main()

{
      int days;
      int rent;
      char model;
      char name[20];
      char carNo[10];

      cout << "Please provide cumstomer Name\t";
      cin >> name;
     
      cout << "\nPlease provide Car Model Description" << endl << endl;
      cout << "\tEnter 'A' for Model 2009.\n";
      cout << "\tEnter 'B' for Model 2010.\n";
      cout << "\tEnter 'C' for Model 2011.\n";
      cin >> model;
     
      cout << "\nplease provide following information:" << endl << endl;
      cout << "Car No:\t\t";
      cin >> carNo;
     
      cout << "Number of days\t";
      cin >> days;
      cout << endl << endl;
     
      switch(model)
      {
           case 'A':
           case 'a':
                      cout << "Customer Name:\t" << name << endl;
                      cout << "Car Model:\t2009" << endl;
                      cout << "Car No:\t\t" << carNo << endl;
                      cout << "Number of days:\t" << days << endl;
                      rent = amount(model, days);
                      cout << "Your Rental Amaount is:\t" << rent << endl;
           break;

           case 'B':
           case 'b':
                      cout << "Customer Name:\t" << name << endl;
                      cout << "Car Model:\t2010" << endl;
                      cout << "Car No:\t\t" << carNo << endl;
                      cout << "Number of days:\t" << days << endl;
                      rent = amount(model, days);
                      cout << "Your Rental Amaount is:\t" << rent << endl;
           break;
          
           case 'C':
           case 'c':
                      cout << "Customer Name:\t" << name << endl;
                      cout << "Car Model:\t2011" << endl;
                      cout << "Car No:\t\t" << carNo << endl;
                      cout << "Number of days:\t" << days << endl;
                      rent = amount(model, days);
                      cout << "Your Rental Amaount is:\t" << rent << endl;
           break;
          
           default:
                   cout << "please select only 2009, 2010, 2011 car models";
          
           }

      system("pause");
      }
    
int amount(char m, int d){
    if(m == 'A' || m == 'a')
    return (5000 * d);
   
    else if(m == 'B' || m == 'b')
    return (8000 * d);
       
    else if(m == 'C' || m == 'c')
    return (10000 * d);
    }
 




--
Yon Ghalat B Nai Hota chehron Ka Ta'asur Lakin.
Log Waise Hote B Nai Jiasay Nazar Ayte Hain
                       <<<<<<< sAd pAncHi >>>>>>>


             

--
You received this message because you are subscribed to the Google Groups "Virtual University of Pakistan" group.
To post to this group, send email to discussion_vu@googlegroups.com.
To unsubscribe from this group, send email to discussion_vu+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/discussion_vu?hl=en.

--
You received this message because you are subscribed to the Google Groups "Virtual University of Pakistan" group.
To post to this group, send email to discussion_vu@googlegroups.com.
To unsubscribe from this group, send email to discussion_vu+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/discussion_vu?hl=en.

No comments:

Post a Comment

PAID CONTENT