0% found this document useful (0 votes)
4 views3 pages

Simple Banking and Ticket Booking Systems

The document outlines various programming systems including a Simple Banking System, Library Management System, Railway Ticket Booking System, Movie Ticket Booking System, and a School Admission System, each with functions for specific operations. It also includes a Real-Life Calculator program that performs basic arithmetic operations based on user input. The code snippets demonstrate the structure and functionality of each system in C programming language.

Uploaded by

shobhakhatal1980
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views3 pages

Simple Banking and Ticket Booking Systems

The document outlines various programming systems including a Simple Banking System, Library Management System, Railway Ticket Booking System, Movie Ticket Booking System, and a School Admission System, each with functions for specific operations. It also includes a Real-Life Calculator program that performs basic arithmetic operations based on user input. The code snippets demonstrate the structure and functionality of each system in C programming language.

Uploaded by

shobhakhatal1980
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

switch(choice) {

1. Simple Banking System case 1: deposit();


#include <stdio.h> break;
#include <string.h> case 2: withdraw();
char name[50]; // Global variables break;
int accountNumber; case 3: displayAccount();
float balance; break;
void createAccount() // Function to create account case 4: printf("Exiting...\n");
{ break;
printf("Enter Name: "); default: printf("Invalid choice! Try again.\n\n");
scanf("%s", name); }
printf("Enter Account Number: "); return 0;
scanf("%d", &accountNumber); }
balance = 0.0;
printf("Account created successfully!\n\n"); 2. LIBRARY MANAGEMENT SYSTEM
}
void deposit() // Function to deposit money #include <stdio.h>
{ int daysLate;
float amount; float fine;
printf("Enter amount to deposit: "); void issueBook() //Issue book
scanf("%f", &amount); {
balance += amount; printf("\nBook issued successfully.\n");
printf("Amount deposited successfully. New Balance: }
%.2f\n\n", balance); void returnBook() //Return book
} {
void withdraw() // Function to withdraw money printf("Enter number of late days: ");
{ scanf("%d", &daysLate);
float amount; }
printf("Enter amount to withdraw: "); void calculateFine() //Fine calculation
scanf("%f", &amount); {
if(amount > balance) if (daysLate > 0)
printf("Insufficient balance!\n\n"); fine = daysLate * 5;
else else
{ fine = 0;
balance -= amount; }
printf("Amount withdrawn successfully. New Balance: %.2f\ void displayFine() //Display fine
n\n", balance); {
} printf("Fine Amount: Rs. %.2f\n", fine);
} }
void displayAccount() // display account details int main()
{ {
printf("\n--- Account Details ---\n"); issueBook();
printf("Name: %s\n", name); returnBook();
printf("Account Number: %d\n", accountNumber); calculateFine();
printf("Balance: %.2f\n\n", balance); displayFine();
} return 0;
int main() }
{
int choice;
createAccount();
printf("1. Deposit\n2. Withdraw\n3. Display Account\
n4. Exit\nEnter choice: "); 3. RAILWAY TICKET BOOKING SYSTEM
scanf("%d", &choice); #include <stdio.h>
int seats; {
float fare; printf("\nTickets Booked: %d", tickets);
void bookTicket() //Book ticket printf("\nTotal Amount: Rs. %.2f\n", total);
{ }
printf("Enter number of seats: "); int main() {
scanf("%d", &seats); selectShow();
} ticketCount();
void calculateFare() //Calculate fare calculateAmount();
{ displayTicket();
fare = seats * 450; return 0;
} }
void displayTicket() //Display ticket
{ 5. SCHOOL ADMISSION SYSTEM
printf("\nTickets Booked: %d", seats); #include <stdio.h>
printf("\nTotal Fare: Rs. %.2f\n", fare);
} char name[30];
int main() { int class;
bookTicket(); float fee;
calculateFare(); void inputDetails() //Input details
displayTicket(); {
return 0; printf("Enter student name: ");
} scanf("%s", name);
printf("Enter class (1–10): ");
4. MOVIE TICKET BOOKING SYSTEM scanf("%d", &class);
#include <stdio.h> }
int show, tickets; void calculateFee() //Calculate fee
float total; {
void selectShow() //Select show if (class <= 5)
{ fee = 15000;
printf("\n 1. Morning Show (Rs.120)"); else
printf("\n 2. Evening Show (Rs.180)"); fee = 25000;
printf("\n Select show: "); }
scanf("%d", &show); void displayDetails() //Display details
} {
void ticketCount() //Ticket count printf("\nStudent Name: %s", name);
{ printf("\nClass: %d", class);
printf("Enter number of tickets: "); printf("\nAdmission Fee: Rs. %.2f\n", fee);
scanf("%d", &tickets); }
}
void calculateAmount() //Calculate amount int main()
{ {
if (show == 1) inputDetails();
total = tickets * 120; calculateFee();
else if (show == 2) displayDetails();
total = tickets * 180; return 0;
else }
total = 0;
}

Real-Life Calculator
void displayTicket() //Display ticket #include <stdio.h>
void add(int a, int b) {
printf("Addition = %d\n", a + b); switch(op) {
} case '+': printf("Result = %d", a + b); break;
case '-': printf("Result = %d", a - b); break;
void subtract(int a, int b) { case '*': printf("Result = %d", a * b); break;
printf("Subtraction = %d\n", a - b); case '/':
} if(b != 0)
printf("Result = %.2f", (float)a / b);
void multiply(int a, int b) { else
printf("Multiplication = %d\n", a * b); printf("Error");
} break;
default:
void divide(int a, int b) { printf("Invalid Operator");
if (b != 0) }
printf("Division = %.2f\n", (float)a / b); }
else
printf("Division by zero not allowed\n"); int main() {
} int x, y;
char op;
int main() {
int x, y, choice; printf("Enter expression (a + b): ");
printf("Enter two numbers: "); scanf("%d %c %d", &x, &op, &y);
scanf("%d %d", &x, &y);
printf("\[Link]\[Link]\[Link]\ calculator(x, y, op);
[Link]\n");
printf("Enter choice: "); return 0;
scanf("%d", &choice); }

switch(choice) {
case 1: add(x, y); break;
case 2: subtract(x, y); break;
case 3: multiply(x, y); break;
case 4: divide(x, y); break;
default: printf("Invalid Choice");
}

return 0;
}

Calculator Using Switch Inside Function


Program
#include <stdio.h>

void calculator(int a, int b, char op) {

You might also like