Skip to content
Related Articles

Related Articles

Improve Article

Tourism Management System in C/C++

  • Last Updated : 22 Sep, 2021

The Tourism Management System is implemented by C programming. It is as same as one can see while going for online booking. Here, the underlying idea is to present users with two choices International or India Tour packages. Then according to the choice, the available packages will be displayed.  The next step is to mention the total number of passengers and all the necessary details of the passengers. The total amount will be evaluated and a receipt will be generated on the screen.

Approach:

Attention reader! All those who say programming isn't for kids, just haven't met the right mentors yet. Join the  Demo Class for First Step to Coding Coursespecifically designed for students of class 8 to 12. 

The students will get to learn more about the world of programming in these free classes which will definitely help them in making a wise career choice in the future.

  • A structure is implemented for taking the details of the passengers like name, gender, and age.
  • Six functions– void details(), void add_node(char, char, int), void receipt(), void heading(), void inter(), void india() are created to handle different functionality.
  • The heading() function is declared that will make the heading of the portal.
  • The system(“cls”) is used to clear our screen.
  • Three elements are added in the structure like two strings one for taking passenger name and gender, and one integer for taking passenger age. Also, the structure pointer will be used that will help to link the next node of another passenger. It is similar to a linked list.
  • Some character arrays are defined and some integer arrays as globally.
  • The user has to give choice for International or Indian Tour packages.
  • If the user choose International tour packages then inter() function will be called. Here, the user has to choose certain packages from a list.
  • If the user choose the India tour package then india() function will be called. Here, the user has to choose certain packages from a list.
  • The details() function will be called to take the number of passengers.
  • A for loop will be executed to take details of each passenger. Then the taken details will be sent to the add_node() function.
  • In the add_node function, every detail will store into a node for each passenger. This node will link each other. This is based on the linked list concept.
  • At last, the receipt() function will be called, which will display all the necessary details.

Source Code: Below is the implementation of the above approach

C




// C program to implement
// the above approach
 
#include <conio.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
 
// Defining Structure
typedef struct mynode {
    char name[20];
    char gen[6];
    int age;
    struct mynode* link;
} Node;
Node* start = NULL;
 
// Declaring Function Used
// In This Program
void heading();
void details();
void inter();
void india();
void receipt();
 
// Global variables
int k, amount;
char type[60], place[30], date[20];
 
// Driver Code
void main()
{
    int a;
 
    // Calling heading() function
    heading();
 
    // Taking Choice From User
    printf("\t\t\t\t1. International "
           "Tour Packages\n");
    printf("\t\t\t\t2. India Tour Packages\n");
    printf("\t\t\t\tEnter Choice: ");
    scanf("%d", &a);
    switch (a) {
    // Calling inter() function
    case 1:
        inter();
        break;
 
    // Calling india() function
    case 2:
        india();
        break;
 
    default:
        printf("Enter Right Choice...");
        break;
    }
 
    // Calling details() function
    details();
 
    // Calling receipt() function
    receipt();
}
 
// Function To Take Package
// Choice From India
void india()
{
    int a;
 
    // Clearing Screen
    system("cls");
 
    // Calling heading() function
    heading();
    strcpy(type, "India Tour Package");
    printf("\t\t\t\t1. Simla Tour Packages    "
           "6 Days 7 Nights (18880/-)\n");
    printf("\t\t\t\t2. Kashmir Tour Packages "
           "5 Days 4 Nights (35500/-)\n");
    printf("\t\t\t\t3. Kolkata Tour Packages "
           "11 Days 10 Nights (10000/-)\n");
    printf("\t\t\t\tEnter Choice: ");
    scanf("%d", &a);
    if (a == 1) {
        strcpy(place, "Simla Tour");
        amount = 18880;
    }
    else if (a == 2) {
        strcpy(place, "Kashmir Tour");
        amount = 35500;
    }
    else if (a == 3) {
        strcpy(place, "Kolkata Tour");
        amount = 10000;
    }
    else
        printf("Enter Correct Choice...");
}
 
// Function To Take Package Choice
// From International
void inter()
{
    int a;
 
    // Clearing Screen
    system("cls");
 
    // Calling heading() function
    heading();
    strcpy(type, "International Tour Package");
    printf("\t\t\t\t1. England Tour Packages "
           "6 Days 7 Nights (28880/-)\n");
    printf("\t\t\t\t2. Thailand Tour Packages "
           "5 Days 4 Nights (15500/-)\n");
    printf("\t\t\t\t3. New York Tour Packages "
           "11 Days 10 Nights (567800/-)\n");
    printf("\t\t\t\tEnter Choice: ");
    scanf("%d", &a);
    if (a == 1) {
        strcpy(place, "England Tour");
        amount = 28880;
    }
    else if (a == 2) {
        strcpy(place, "Thailand Tour");
        amount = 15500;
    }
    else if (a == 3) {
        strcpy(place, "New York Tour");
        amount = 567800;
    }
    else
        printf("Enter Correct Choice...");
}
 
// Function To Take Passenger Details
void details()
{
    int i, a;
    char val[20], gen[6];
 
    // Clearing Screen
    system("cls");
 
    // Calling heading() function
    heading();
    printf("\t\t\t\tEnter Number Of "
           "Passengers: ");
    scanf("%d", &k);
    printf("\t\t\t\tEnter Date "
           "(DD/MM/YY): ");
    fflush(stdin);
    gets(date);
    for (i = 1; i <= k; i++) {
        system("cls");
        heading();
        printf("\t\t\t\tEnter The %dth "
               "Passenger Name: ",
               i);
        fflush(stdin);
        gets(val);
        printf("\t\t\t\tEnter The %dth "
               "Passenger Gender: ",
               i);
        fflush(stdin);
        gets(gen);
        printf("\t\t\t\tEnter The %dth "
               "Passenger Age: ",
               i);
        fflush(stdin);
        scanf("%d", &a);
 
        // Calling add_node() function
        add_node(val, gen, a);
    }
}
 
// Function to add details in
// node for each passengers
void add_node(char lol[20],
              char der[6], int b)
{
    Node *newptr = NULL, *ptr;
    newptr = (Node*)malloc(sizeof(Node));
    strcpy(newptr->name, lol);
    strcpy(newptr->gen, der);
    newptr->age = b;
    newptr->link = NULL;
    if (start == NULL)
        start = newptr;
    else {
        ptr = start;
        while (ptr->link != NULL)
            ptr = ptr->link;
        ptr->link = newptr;
    }
}
 
// Function For Printing Receipt
void receipt()
{
    int i, b;
    Node* ptr = start;
    system("cls");
    heading();
    printf("\n\t\t\t\t**Take Screenshot "
           "For Further Use**\n");
    for (i = 1; i <= k; i++) {
        printf("\t\t\t\t%dst Passenger "
               "Name: ",
               i);
        puts(ptr->name);
        printf("\t\t\t\t%dst Passenger "
               "Gender: ",
               i);
        puts(ptr->gen);
        printf("\t\t\t\t%dst Passenger "
               "Age: %d\n\n",
               i, ptr->age);
        ptr = ptr->link;
    }
    printf("\t\t\t\tSelected Type: ");
    puts(type);
    printf("\t\t\t\tPackage: ");
    puts(place);
    printf("\t\t\t\tDate: ");
    puts(date);
    b = amount * k;
    printf("\t\t\t\tTotal Amount: %d", b);
    printf("\n\t\t\t\t**Thank You For "
           "registration**");
}
 
// Function For Printing Heading
// Of Portal
void heading()
{
    printf("\t\t\t\t***Tourism Package "
           "Management System***\n");
    printf("\t\t\t***Vaccination Certificate "
           "Is Necessary For Travel Purpose***\n\n");
}

Output:




My Personal Notes arrow_drop_up
Recommended Articles
Page :