C Program to Build Tourism Management System on Command Line

Shall we start the article to discuss the concept of “C Program to Build Tourism Management System on Command Line“? Come on! Let’s start the discussion to do this task successfully.

C Program to Build Tourism Management System on Command Line

C Program to Build Tourism Management System on Command Line

Source Code

// 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("tttt1. International "
		"Tour Packagesn");
	printf("tttt2. India Tour Packagesn");
	printf("ttttEnter 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("tttt1. Simla Tour Packages "
		"6 Days 7 Nights (18880/-)n");
	printf("tttt2. Kashmir Tour Packages "
		"5 Days 4 Nights (35500/-)n");
	printf("tttt3. Kolkata Tour Packages "
		"11 Days 10 Nights (10000/-)n");
	printf("ttttEnter 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("tttt1. England Tour Packages "
		"6 Days 7 Nights (28880/-)n");
	printf("tttt2. Thailand Tour Packages "
		"5 Days 4 Nights (15500/-)n");
	printf("tttt3. New York Tour Packages "
		"11 Days 10 Nights (567800/-)n");
	printf("ttttEnter 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("ttttEnter Number Of "
		"Passengers: ");
	scanf("%d", &k);
	printf("ttttEnter Date "
		"(DD/MM/YY): ");
	fflush(stdin);
	gets(date);
	for (i = 1; i <= k; i++) {
		system("cls");
		heading();
		printf("ttttEnter The %dth "
			"Passenger Name: ",
			i);
		fflush(stdin);
		gets(val);
		printf("ttttEnter The %dth "
			"Passenger Gender: ",
			i);
		fflush(stdin);
		gets(gen);
		printf("ttttEnter 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("ntttt**Take Screenshot "
		"For Further Use**n");
	for (i = 1; i <= k; i++) {
		printf("tttt%dst Passenger "
			"Name: ",
			i);
		puts(ptr->name);
		printf("tttt%dst Passenger "
			"Gender: ",
			i);
		puts(ptr->gen);
		printf("tttt%dst Passenger "
			"Age: %dnn",
			i, ptr->age);
		ptr = ptr->link;
	}
	printf("ttttSelected Type: ");
	puts(type);
	printf("ttttPackage: ");
	puts(place);
	printf("ttttDate: ");
	puts(date);
	b = amount * k;
	printf("ttttTotal Amount: %d", b);
	printf("ntttt**Thank You For "
		"registration**");
}

// Function For Printing Heading
// Of Portal
void heading()
{
	printf("tttt***Tourism Package "
		"Management System***n");
	printf("ttt***Vaccination Certificate "
		"Is Necessary For Travel Purpose***nn");
}

Final Thoughts

I hope you have learned the topic of “C Program to Build Tourism Management System on Command Line“. We are always ready to help you at any time. So please ask your doubts about the topic through the comment section. Don’t forget to share this article and bookmark us.

Share on:

Hi, I'm Ranjith a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coding Diksha. Here, I post about programming to help developers.

Leave a Comment