Friends,

i have to submit a project on Car Rental System which is to be made in C.

i have made half of the work like giving out the menus using Switch, but the prof told me that i have to now input the details of the customer and then print it in the end od the program. i have no idea how to it...

please help me, if you want i can post you the codes which i have wrote till now.... i would be grateful !

#include<stdio.h>
#include<conio.h>
void main()
{
    int u,d,r,l;
    clrscr();
    printf("\n CAR RENTAL APPLICATION \n");
    printf("\n ----------------------- \n");
    printf("\n Press 1 for Deluxe Vehicles \n");
    printf("\n Press 2 for Long or Road Trip Vehicles \n");
    printf("\n Press 3 for Luxury Vehicle \n");
    printf("\n ---------------------------- \n");
    printf("\n Press any Option: \n");
    scanf("%d", &u);
    switch(u)
    {
        case 1:
        printf("\n You have chosen Deluxe Vehicles \n");
        printf("\n Deluxe Vehicle Available are \n");
        printf("\n Maruti ZEN, OMNI, V.POLO \n");
        printf("\n ------------------------------ \n");
        printf("\n do u want to hire, Press 1 | ZEN, 2 | OMNI, 3 | POLO \n");
        scanf("%d", &d);
        switch(d)
        {
            case 1:
            printf("\n You have selected ZEN | Cost 4000rs per day \n");
            break;

            case 2:
            printf("\n You have selected OMNI | Cost 5000rs per day \n");
            break;

            case 3:
            printf("\n You have selected Volkswagen Polo | Cost 15,000 per day \n");
            break;
        }
        break;

        case 2:
        printf("\n You have chosen Long Trip Vehicles \n");
        printf("\n Vehicles Available are \n");
        printf("\n TATA SUMO, TAVERA, TOOFAN \n");
        printf("\n ----------------------------- \n");
        printf("\n do u want to hire , press 1 | TATA, 2 | TAVERA, 3 | TOOFAN \n");
        scanf("%d", &r);
        switch (r)
        {
            case 1:
            printf("\n You have selected TATA SUMO | Cost 9000rs per day \n");
            break;

            case 2:
            printf("\n You have selected TAVERA | Cost 12,000rs per day \n");
            break;

            case 3:
            printf("\n You have selected TOOFAN | Cost 10,000rs per day \n");
            break;

        }
        break;

        case 3:
        printf("\n You have chosen Luxury Cars");
        printf("\n Luxury Vehicles Available are \n");
        printf("\n BENZ, BMW, AUDI \n");
        printf("\n ------------------------------ \n");
        printf("\n Do u want to hire, Press 1 | Benz, 2 | BMW, 3 | Audi \n");
        scanf("%d", &l);
        switch(l)
        {
            case 1:
            printf("\n You have selected Benz | Cost 40,000rs per day \n");
            break;

            case 2:
            printf("\n You have selected BMW | Cost 45,000rs per day \n");
            break;

            case 3:
            printf("\n You have selected Audi | Cost 50,000rs per day \n");
            break;
        }
        break;
    }
    getch();
}

Well, void main() should be int main(void), with a return 0 at the end of it (in main).

Having all your code in main() is awkward, you should break it up into fucntions. Usually, every option in the switch statement, gets a new function.

And then you need a big do while loop for the menu itself (which should probably be in a separate function), so the menu can show itself for the next customer, without having to be restarted.

Post up your questions and problems - it's good to see your code (essential really), but people can't respond to problems that you haven't brought up, or answer questions you don't ask.

Good start though. I like the use of the switch statements, and your indentation makes it easy to read your code - so that's a very good start.

thank you. if u have any sample coding of what u stated, cn u link me with it. if i get an idea, i cn start frm where i struck.

You need to specify what these "details of the customer", are. They we'll show you how to make a struct to tie all them together, into one record.

what data types are these details, how many details are there, and what do you want to name their variables?

Edited 4 Years Ago by Adak

yeah,

the details of the customer should contain the following details:

name - char
age - int
address **- char (i doubt, can we used char for such long details ? )
**details of the vehicle
. - it should display the model of the car that the customers has chosed.
amount - the amount of the chosen vehicle + tax (2000rs)

these are the details....

i just want to make this program in simple c....

thanks a lot for helping me out.....

and as u said, i should have given diff no in the cases....

Has your coursework covered data structures yet? You can bundle the car model and price up into a struct type and save yourself some hassle:

struct Car
{
    char make[16];
    char model[16];
    char year[4];
    int price;
};

This let's you have a record of the all the car makes and models which in each category:

const struct Car SUV[] = { 
                              {"Tata", "Sumo", "2010", 9000},
                              {"Chevrolet", "Tavera", "2009", 12000},
                              {"Trax", "Toofan", "2011", 10000}
                          };
const int SUV_COUNT = 3;

You can use these records to display the model and price info for the category:

        case 2:
        printf("\n You have chosen Long Trip Vehicles \n");
        printf("\n Vehicles Available are \n");
        for (i = 0; i < SUV_COUNT; i++)
        {
            printf("%d: %s %s, ", i + 1, SUV[i].make, SUV[i].model);
        }
        printf("\n\n ----------------------------- \n");
        printf("Enter the number of the car model you want: ");
        scanf("%d", &r);
        r--;
        printf("\n You have selected %s %s %s | Cost %d rs per day \n", 
               SUV[r].year, SUV[r].make, SUV[r].model, SUV[r].price);

        break;

You would do the same for each of the other two categories.

You can similarly bundle the customer info into a single struct, like so, with a pointer to the car information:

struct Customer 
{
    char name[32];
    int age;
    char address[3][32];      /* three lines of 32 chars each */
    struct Car* vehicle;
} customer;

You could then read in the customer information at the beginning of the program, and print it out again at the end along with the car information.

no, till now we have not reached data structures... but i can try struct.... even some suggest that i can do the above program using goto label and all... its still remaining to be tried... but thanks a lot buddy.... u rock... i will try to do it in your first... :)

Do you need to print out one customer's details at a time, as they rent a car, or do you need to print out EVERY customer's details, maybe at the end of the day or week?

I'm trying to see what you need for your output - one customer details output at a time, or several at a time?

#include<stdio.h>
#include<conio.h>
void main()
{
    int u,d,r,l,nod;
    char n;
    printf("\n Enter the no of days \n");
    scanf("%d", &nod);
    printf (" Name : \n");
    scanf("%c", &n);
    clrscr();
    printf("\n CAR RENTAL APPLICATION \n");
    printf("\n ----------------------- \n");
    printf("\n Press 1 for Deluxe Vehicles \n");
    printf("\n Press 2 for Long or Road Trip Vehicles \n");
    printf("\n Press 3 for Luxury Vehicle \n");
    printf("\n ---------------------------- \n");
    printf("\n Press any Option: \n");
    scanf("%d", &u);
    switch(u)
    {
        case 1:
        printf("\n You have chosen Deluxe Vehicles \n");
        printf("\n Deluxe Vehicle Available are \n");
        printf("\n Maruti ZEN, OMNI, V.POLO \n");
        printf("\n ------------------------------ \n");
        printf("\n do u want to hire, Press 1 | ZEN, 2 | OMNI, 3 | POLO \n");
        scanf("%d", &d);
        switch(d)
        {
            case 1:
            printf("\n You have selected ZEN | Cost 4000rs per day \n");
            break;

            case 2:
            printf("\n You have selected OMNI | Cost 5000rs per day \n");
            break;

            case 3:
            printf("\n You have selected Volkswagen Polo | Cost 15,000 per day \n");
            break;
        }
        break;

        case 2:
        printf("\n You have chosen Long Trip Vehicles \n");
        printf("\n Vehicles Available are \n");
        printf("\n TATA SUMO, TAVERA, TOOFAN \n");
        printf("\n ----------------------------- \n");
        printf("\n do u want to hire , press 1 | TATA, 2 | TAVERA, 3 | TOOFAN \n");
        scanf("%d", &r);
        switch (r)
        {
            case 1:
            printf("\n You have selected TATA SUMO | Cost 9000rs per day \n");
            break;

            case 2:
            printf("\n You have selected TAVERA | Cost 12,000rs per day \n");
            break;

            case 3:
            printf("\n You have selected TOOFAN | Cost 10,000rs per day \n");
            break;

        }
        break;

        case 3:
        printf("\n You have chosen Luxury Cars");
        printf("\n Luxury Vehicles Available are \n");
        printf("\n BENZ, BMW, AUDI \n");
        printf("\n ------------------------------ \n");
        printf("\n Do u want to hire, Press 1 | Benz, 2 | BMW, 3 | Audi \n");
        scanf("%d", &l);
        switch(l)
        {
            case 1:
            printf("\n You have selected Benz | Cost 40,000rs per day \n");
            break;

            case 2:
            printf("\n You have selected BMW | Cost 45,000rs per day \n");
            break;

            case 3:
            printf("\n You have selected Audi | Cost 50,000rs per day \n");
            break;
        }
        break;
    }

    //printf("\n Enter the no of days \n");
    //scanf("%d", &nod);
    //printf("\n Name of the client \n");
    //scanf("%c", &n);
    clrscr();
    printf("%d",nod);
    getch();
}

execute the code and see the output, how the no of days which i made the user enter at first got displayed at the end of the switch selection while output..... this is the updated code... thanks a lot adak, u r helping a lot buddy :)

There is no output of the customer info, so what do you need? Number of days, and name of the client, and the type of vehicle would seem required minimum.

Do you need anything else from the custome? Maybe address, payment type, or ???

ok... i just did some things.. now i need to show in the output the type of the vehicle selected, along with the no of days * amount of that vehicle.....

OK, keep going! Sounds like you're on a roll. ;) If you have a specific question, be sure to post your latest code - otherwise I'm blind to your changes.

here is the latest changed code...

#include<stdio.h>
#include<conio.h>
void main()
{
    int u,d,r,l,nod,phno;
    char name[100];
    char city[100];
    clrscr();
    printf("Name of the Customer \n");
    scanf("%s", name);
    printf("Place of the Customer \n");
    scanf("%s", city);
    printf("\n Enter the ph no \n");
    scanf("%d", &phno);
    printf("\n Enter the no of days \n");
    scanf("%d", &nod);

    clrscr();
    printf("\n CAR RENTAL APPLICATION \n");
    printf("\n ----------------------- \n");
    printf("\n Press 1 for Deluxe Vehicles \n");
    printf("\n Press 2 for Long or Road Trip Vehicles \n");
    printf("\n Press 3 for Luxury Vehicle \n");
    printf("\n ---------------------------- \n");
    printf("\n Press any Option: \n");
    scanf("%d", &u);
    switch(u)
    {
        case 1:
        printf("\n You have chosen Deluxe Vehicles \n");
        printf("\n Deluxe Vehicle Available are \n");
        printf("\n Maruti ZEN, OMNI, V.POLO \n");
        printf("\n ------------------------------ \n");
        printf("\n do u want to hire, Press 1 | ZEN, 2 | OMNI, 3 | POLO \n");
        scanf("%d", &d);
        switch(d)
        {
            case 1:
            printf("\n You have selected ZEN | Cost 4000rs per day \n");
            break;

            case 2:
            printf("\n You have selected OMNI | Cost 5000rs per day \n");
            break;

            case 3:
            printf("\n You have selected Volkswagen Polo | Cost 15,000 per day \n");
            break;
        }
        break;

        case 2:
        printf("\n You have chosen Long Trip Vehicles \n");
        printf("\n Vehicles Available are \n");
        printf("\n TATA SUMO, TAVERA, TOOFAN \n");
        printf("\n ----------------------------- \n");
        printf("\n do u want to hire , press 1 | TATA, 2 | TAVERA, 3 | TOOFAN \n");
        scanf("%d", &r);
        switch (r)
        {
            case 1:
            printf("\n You have selected TATA SUMO | Cost 9000rs per day \n");
            break;

            case 2:
            printf("\n You have selected TAVERA | Cost 12,000rs per day \n");
            break;

            case 3:
            printf("\n You have selected TOOFAN | Cost 10,000rs per day \n");
            break;

        }
        break;

        case 3:
        printf("\n You have chosen Luxury Cars");
        printf("\n Luxury Vehicles Available are \n");
        printf("\n BENZ, BMW, AUDI \n");
        printf("\n ------------------------------ \n");
        printf("\n Do u want to hire, Press 1 | Benz, 2 | BMW, 3 | Audi \n");
        scanf("%d", &l);
        switch(l)
        {
            case 1:
            printf("\n You have selected Benz | Cost 40,000rs per day \n");
            break;

            case 2:
            printf("\n You have selected BMW | Cost 45,000rs per day \n");
            break;

            case 3:
            printf("\n You have selected Audi | Cost 50,000rs per day \n");
            break;
        }
        break;
    }
    clrscr();
    printf("%s \n",name);
    printf("%s \n",city);
    printf("%d \n",&phno);
    printf("%d \n",nod);
    getch();
}

Line #102, remove the &
I would consider changing phno to a string, because it's possible that an integer would overflow with a long phone number - just a suggestion however.

You didn't ask any questions, so I'm not sure what to answer otherwise.

void main() should always be int main() with a return of 0, btw. That tells you (if you want), wether the program ran to completion or had a run-time failure.

okay...thanks a lot buddy.... i will do the change.... still figuring out how to get information from inside the switch statement,,,,

I don't understand the problem of getting info from inside the switch statement. It's the same as getting info from anywhere else in main().

i mean.. i want the information of the selected switch outside along with the information of the customers....

At the beginning of the program, add

#include <string.h>

Now in main() add two more variables:

int price;
char car_model[100];

Then, inside the switch(), instead of printing the information, you set these two values, then print them after the end of the switch():

        switch(d)
        {
            case 1:
            strncpy(car_model, "ZEN", 100);
            price = 4000;
            break;

            case 2:
            strncpy(car_model, "OMNI", 100);
            price = 5000;           
            break;

            case 3:
            strncpy(car_model, "Volkswagen Polo", 100);
            price = 15000;

            break;
        }

        printf("\n You have selected %s | Cost %drs per day \n", car_model, price);
        break;

Do the same for the other two inner switch() statements and you should be good to go. You then can use these variables at the end of the program as well.

Mind you, there are all sorts of ways to simplify this program further; I expect you'll see some of them if you look.

Edited 4 Years Ago by Schol-R-LEA: Forgot - you need to use strncpy() in C.

i have done this way and i think this should do...

#include<stdio.h>
#include<conio.h>
void main()
{
    int u,d,r,l,nod;
    char name[100],phno[10];
    char city[100];
    clrscr();
    printf("Name of the Customer \n");
    scanf("%s", name);
    printf("Place of the Customer \n");
    scanf("%s", city);
    printf("\n Enter the ph no \n");
    scanf("%s", phno);
    printf("\n Enter the no of days \n");
    scanf("%d", &nod);

    clrscr();
    printf("\n CAR RENTAL APPLICATION \n");
    printf("\n ----------------------- \n");
    printf("\n Press 1 for Deluxe Vehicles \n");
    printf("\n Press 2 for Long or Road Trip Vehicles \n");
    printf("\n Press 3 for Luxury Vehicle \n");
    printf("\n ---------------------------- \n");
    printf("\n Press any Option: \n");
    scanf("%d", &u);
    switch(u)
    {
        case 1:
        printf("\n You have chosen Deluxe Vehicles \n");
        printf("\n Deluxe Vehicle Available are \n");
        printf("\n Maruti ZEN, OMNI, V.POLO \n");
        printf("\n ------------------------------ \n");
        printf("\n do u want to hire, Press 1 | ZEN, 2 | OMNI, 3 | POLO \n");
        scanf("%d", &d);
        clrscr();
        switch(d)
        {
            case 1:
            printf("\n You have selected ZEN | %ldrs per day \n ie total %ldRs\n",120000/nod,120000);
            break;

            case 2:
            printf("\n You have selected OMNI | %ldrs per day \n ie total %ldRs\n",120000/nod,120000);
            break;

            case 3:
            printf("\n You have selected Volkswagen Polo | %ldrs per day \n ie total %ldRs\n",120000/nod,120000);
            break;
        }
        break;

        case 2:
        printf("\n You have chosen Long Trip Vehicles \n");
        printf("\n Vehicles Available are \n");
        printf("\n TATA SUMO, TAVERA, TOOFAN \n");
        printf("\n ----------------------------- \n");
        printf("\n do u want to hire , press 1 | TATA, 2 | TAVERA, 3 | TOOFAN \n");
        scanf("%d", &r);
        clrscr();
        switch (r)
        {
            case 1:
            printf("\n You have selected TATA SUMO | %ldrs per day \n ie total %ldRs\n",120000/nod,120000);
            break;

            case 2:
            printf("\n You have selected TAVERA | %ldrs per day \n ie total %ldRs\n",120000/nod,120000);
            break;

            case 3:
            printf("\n You have selected TOOFAN | %ldrs per day \n ie total %ldRs\n",120000/nod,120000);
            break;

        }
        break;

        case 3:
        printf("\n You have chosen Luxury Cars");
        printf("\n Luxury Vehicles Available are \n");
        printf("\n BENZ, BMW, AUDI \n");
        printf("\n ------------------------------ \n");
        printf("\n Do u want to hire, Press 1 | Benz, 2 | BMW, 3 | Audi \n");
        scanf("%d", &l);
        clrscr();
        switch(l)
        {
            case 1:
            printf("\n You have selected Benz | Cost %ldrs per day \n ie total %ldRs\n",120000/nod,120000);
            break;

            case 2:
            printf("\n You have selected BMW | %ldrs per day \n ie total %ldRs\n",120000/nod,120000);
            break;

            case 3:
            printf("\n You have sel0ected Audi | %ldrs per day \n ie total %ldRs\n",120000/nod,120000);
            break;
        }
        break;
    }

    printf("%s \n",name);
    printf("%s \n",city);
    printf("%s \n",phno);
    printf("%d \n",nod);
    getch();
}

pls check the code and run, it yielded my desired output.... you can make the corrections if you want..... finally some breakthrough.... thanks guys...

First off, as we've already said before, you really should change void main() to int main() and have it return 0; at the end of the function.

Second, the way you now have it, the prices for all the cars will be the same, and total price will always be 120,000; the price per day will decrease with the number of days. I think what you want is more like:

 printf("\n You have selected TATA SUMO | %ldrs per day \n ie total %ldRs\n",12000, 12000 * nod);

yep, i forgot about that void main (), i will do it..... yeah, i made the changes ... for different car, diiferent rates... i will do the steps, u have shown now....

dude, i have made the changes.. void to int...
and changed the amounts.. changed my previous code.... can u compile and run and check this one... the amount is coming wrong,... :(

#include<stdio.h>
#include<conio.h>
int main()
{
    int u,d,r,l,nod;
    char name[100],phno[10];
    char city[100], vno[100];
    clrscr();
    printf("Name of the Customer : \n");
    scanf("%s", name);
    printf("Place of the Customer :\n");
    scanf("%s", city);
    printf("\n Enter the ph no :\n");
    scanf("%s", phno);
    printf("\n Enter the no of days : \n");
    scanf("%d", &nod);
    printf("\n Enter the hired Vehicle Reg No : \n");
    scanf("%s", &vno);

    clrscr();
    printf("\n CAR RENTAL APPLICATION \n");
    printf("\n ----------------------- \n");
    printf("\n Press 1 for Deluxe Vehicles \n");
    printf("\n Press 2 for Long or Road Trip Vehicles \n");
    printf("\n Press 3 for Luxury Vehicle \n");
    printf("\n ---------------------------- \n");
    printf("\n Press any Option: \n");
    scanf("%d", &u);
    switch(u)
    {
        case 1:
        printf("\n You have chosen Deluxe Vehicles \n");
        printf("\n Deluxe Vehicle Available are \n");
        printf("\n Maruti ZEN, OMNI, V.POLO \n");
        printf("\n ------------------------------ \n");
        printf("\n do u want to hire, Press 1 | ZEN, 2 | OMNI, 3 | POLO \n");
        scanf("%d", &d);
        clrscr();
        switch(d)
        {
            case 1:
            printf("\n You have selected ZEN | %ldrs per day \n ie total %ldRs\n",10000/nod,10000);
            break;

            case 2:
            printf("\n You have selected OMNI | %ldrs per day \n ie total %ldRs\n",15000/nod,15000);
            break;

            case 3:
            printf("\n You have selected Volkswagen Polo | %ldrs per day \n ie total %ldRs\n",170000/nod,170000);
            break;
        }
        break;

        case 2:
        printf("\n You have chosen Long Trip Vehicles \n");
        printf("\n Vehicles Available are \n");
        printf("\n TATA SUMO, TAVERA, TOOFAN \n");
        printf("\n ----------------------------- \n");
        printf("\n do u want to hire , press 1 | TATA, 2 | TAVERA, 3 | TOOFAN \n");
        scanf("%d", &r);
        clrscr();
        switch (r)
        {
            case 1:
            printf("\n You have selected TATA SUMO | %ldrs per day \n ie total %ldRs\n",20000/nod,20000);
            break;

            case 2:
            printf("\n You have selected TAVERA | %ldrs per day \n ie total %ldRs\n",15000/nod,15000);
            break;

            case 3:
            printf("\n You have selected TOOFAN | %ldrs per day \n ie total %ldRs\n",12000/nod,12000);
            break;

        }
        break;

        case 3:
        printf("\n You have chosen Luxury Cars");
        printf("\n Luxury Vehicles Available are \n");
        printf("\n BENZ, BMW, AUDI \n");
        printf("\n ------------------------------ \n");
        printf("\n Do u want to hire, Press 1 | Benz, 2 | BMW, 3 | Audi \n");
        scanf("%d", &l);
        clrscr();
        switch(l)
        {
            case 1:
            printf("\n You have selected Benz | Cost %ldrs per day \n ie total %ldRs\n",20000/nod,20000);
            break;

            case 2:
            printf("\n You have selected BMW | %ldrs per day \n ie total %ldRs\n",19000/nod,19000);
            break;

            case 3:
            printf("\n You have selected Audi | %ldrs per day \n ie total %ldRs\n",25000/nod,25000);
            break;
        }
        break;
    }

    printf("The name of the customer is : %s \n",name);
    printf("Place of Hiring : %s \n",city);
    printf(" Contact number of the Customer is : %s \n",phno);
    printf("Number of days Vehicle is hired : %d \n",nod);
    printf(" Registeration number of the hired vehicle : %s \n",vno);
    getch();
    return 0;
}

As I said earlier, you want to have the per day as a constant, and multiply that by the number of days to get the total.

i have done as u said.... still the nod * amount output is coming weird...

#include<stdio.h>
#include<conio.h>
int main()
{
    int u,d,r,l,nod;
    char name[100],phno[10];
    char city[100], vno[100];
    clrscr();
    printf("Name of the Customer : \n");
    scanf("%s", name);
    printf("Place of the Customer :\n");
    scanf("%s", city);
    printf("\n Enter the ph no :\n");
    scanf("%s", phno);
    printf("\n Enter the no of days : \n");
    scanf("%d", &nod);
    printf("\n Enter the hired Vehicle Reg No : \n");
    scanf("%s", &vno);

    clrscr();
    printf("\n CAR RENTAL APPLICATION \n");
    printf("\n ----------------------- \n");
    printf("\n Press 1 for Deluxe Vehicles \n");
    printf("\n Press 2 for Long or Road Trip Vehicles \n");
    printf("\n Press 3 for Luxury Vehicle \n");
    printf("\n ---------------------------- \n");
    printf("\n Press any Option: \n");
    scanf("%d", &u);
    switch(u)
    {
        case 1:
        printf("\n You have chosen Deluxe Vehicles \n");
        printf("\n Deluxe Vehicle Available are \n");
        printf("\n Maruti ZEN, OMNI, V.POLO \n");
        printf("\n ------------------------------ \n");
        printf("\n do u want to hire, Press 1 | ZEN, 2 | OMNI, 3 | POLO \n");
        scanf("%d", &d);
        clrscr();
        switch(d)
        {
            case 1:
            printf("\n You have selected ZEN | %ldrs per day \n ie total %ldRs\n",10000, 10000*nod);
            break;

            case 2:
            printf("\n You have selected OMNI | %ldrs per day \n ie total %ldRs\n",15000, 15000*nod);
            break;

            case 3:
            printf("\n You have selected Volkswagen Polo | %ldrs per day \n ie total %ldRs\n",17000, 17000*nod);
            break;
        }
        break;

        case 2:
        printf("\n You have chosen Long Trip Vehicles \n");
        printf("\n Vehicles Available are \n");
        printf("\n TATA SUMO, TAVERA, TOOFAN \n");
        printf("\n ----------------------------- \n");
        printf("\n do u want to hire , press 1 | TATA, 2 | TAVERA, 3 | TOOFAN \n");
        scanf("%d", &r);
        clrscr();
        switch (r)
        {
            case 1:
            printf("\n You have selected TATA SUMO | %ldrs per day \n ie total %ldRs\n",20000, 20000*nod);
            break;

            case 2:
            printf("\n You have selected TAVERA | %ldrs per day \n ie total %ldRs\n",19000, 19000*nod);
            break;

            case 3:
            printf("\n You have selected TOOFAN | %ldrs per day \n ie total %ldRs\n",15000, 15000*nod);
            break;

        }
        break;

        case 3:
        printf("\n You have chosen Luxury Cars");
        printf("\n Luxury Vehicles Available are \n");
        printf("\n BENZ, BMW, AUDI \n");
        printf("\n ------------------------------ \n");
        printf("\n Do u want to hire, Press 1 | Benz, 2 | BMW, 3 | Audi \n");
        scanf("%d", &l);
        clrscr();
        switch(l)
        {
            case 1:
            printf("\n You have selected Benz | Cost %ldrs per day \n ie total %ldRs\n",25000, 25000*nod);
            break;

            case 2:
            printf("\n You have selected BMW | %ldrs per day \n ie total %ldRs\n",20000, 20000*nod);
            break;

            case 3:
            printf("\n You have selected Audi | %ldrs per day \n ie total %ldRs\n",30000, 30000*nod);
            break;
        }
        break;
    }

    printf("The name of the customer is : %s \n",name);
    printf("Place of Hiring : %s \n",city);
    printf(" Contact number of the Customer is : %s \n",phno);
    printf("Number of days Vehicle is hired : %d \n",nod);
    printf(" Registeration number of the hired vehicle : %s \n",vno);
    getch();
    return 0;
}
This question has already been answered. Start a new discussion instead.