Computer Project
Computer Project
Name of Students
Manav Koirala
Bibas Adhikari
Nitanta Acharya
Nabin Pandey
Class:12
Section:D8
Shift: Day
Name of Department Of HOD:Gaurav Mishra
Submission Date: 2081-10-
CERTIFICATE OF AUTHENTICITY
We hereby declare that all the works done here are original and are not plagiarized or copied
and are not submitted in others besides in this project. This Project title “COMPUTER
PROJECT WORK ON C PROGRAMMING” was also done under the guidance of our
Computer Teacher Mr.Gaurav Mishra.
We would like to thank our friends and family for helping us do this project. We also like to
thank our Computer Department for allowing us to work in this wonderful project. We also
like to thank our Computer Teacher Mr Gaurab sir for allowing us to work in this wonderful
project as well as his guidance in this project.
Name:
Manav Koirala
Bibas Adhikari
Nitanta Acharya
Nabin Pandey
I
Table of Content
Table of Content··························································································II
Abstract···································································································IV
1. School Management System·········································································1
1.1 Introduction······················································································1
1.2 Literature Work··················································································1
1.3 System Design···················································································2
1.4 Implementation··················································································3
1.5 Source Code······················································································5
1.6 Testing And Resulting········································································18
2. Library Management System·······································································19
2.1 Introduction·····················································································19
2.2 Literature Work················································································19
2.3 System Design·················································································19
2.4 Implementation·················································································20
2.5 Source code·····················································································22
2.6 Testing And Resulting········································································30
3.TIC TAC TOE·························································································31
3.1 Introduction·····················································································31
3.2 Literature Work················································································31
3.3 System Design·················································································32
3.4 Implementation·················································································32
3.5 Source Code····················································································33
3.6 Testing And Result············································································37
4. Bus Management System············································································38
4.1 Introduction·····················································································38
4.2 Literature Work················································································38
4.3 System Design·················································································38
4.4 Implementation·················································································39
4.5 Source Code····················································································40
4.6 Testing And Results···········································································44
5. Telecom Billing Systems············································································45
5.1 Introduction·····················································································45
5.2 Literature review···············································································45
5.3 System design··················································································46
5.4 Implementation·················································································46
5.5 Source code····················································································48
5.6 Testing and results·············································································52
6. Conclusion·····························································································54
6.1 School Management Sytem··································································54
II
6.2 Library Management System·································································54
6.3 Tic Tac Toe·····················································································54
6.4 Bus Management Sytem······································································55
7. Refrence································································································56
III
Abstract
Secondly, In Library Management System we defined a library.txt as a main file i.e. for
entering detail of Books as well as when it was taken and as well as for other manipulation in
the given system.
Thirdly, In the game of Tic Tac Toe is a simple, two-player game played on a 3x3 grid.
Players take turns marking a square with either "X" or "O." The first player to align three of
their marks horizontally, vertically, or diagonally wins.
Lastly, In Telecom Billing System is a software that manages data and processes to calculate
and send invoices for telecom services. It also tracks usage, collects payments, and generates
financial reports. Telecom service is one of the biggest services having millions of users and
the data managed by these companies are quite large so, we need some software system to
efficiently manage this data.
IV
V
1. School Management System
1.1 Introduction
School Management System is a fundamental process of using file handling and Structure
work. The process done in this project is that two main files are declared one for teachers and
other for students and independently we can access them while remaining and running in the
same command prompt. Here we can easily check students' details as well as teachers' details
as well.
We can add new details as well as delete or edit the details using ID for both teacher and
student and also we can check all the details that are entered in the file. In this way we can
easily manipulate any data we need. In this System we also implement it in such a way that it
works so we can see Grade 1 to Grade 12 at once separately.
The given Program ask for Students following parameters like; ID,Name,Email,Phone
Number,Address as well as Guardian Name and their phone number as well as their Class
and Section.Whereas for teachers the following parameters are asked like; CID(Colleague
ID),Name, Phone Department, Salary , Experience and their Salary.
Hence,we can Enter,View,Edit,Delete Student and Teacher as well. This allows us to easily
administer any and all works that can be done in the given system.
Before I started the project I used some example shown in our text book “TEXTBOOK OF
COMPUTER SCIENCE” by Dr. Rupendra Man Rajkumar and his example for the given
work in “SCHOOL MANAGEMENT SYSTEM” especially on his work in File Handling
with Structure Program for better understanding of this project.
1
1.3 System Design
2
1.4 Implementation
The following program has a main function which has a switch case and do ... .while loop
such that the user can choose one of many options.
// Student Structure
struct student {
int ID;
char Name[100];
char Address[100];
char Phone[15];
char Email[50];
int Class;
char Section[5];
char GuardianName[100];
char GuardianPhone[15];
};
// Teacher Structure
struct teacher {
int CID;
char Name[100];
char Department[100];
char Phone[15];
char Email[50];
float Salary;
int Experience;
char Address[100];
};
The option here to access are as follows:
1. Register Student
2. Register Teacher
3
3. View Student Records
4. View Teacher Records
5. Edit Student Data
6.Delete Student Data
7.Edit Teacher Data
8.Delete Teacher Data
9. Exit
Similarly two structures one for Teacher and other for student is declared and as stated above
parameters are defined . The two files are also declared as “teacher.txt” for teacher and
“student.txt” for student.
For each option a function is declared such that it works properly to connect them. For
Register Student function RegisterStudent() is declared where record of student can be
added. Similarly RegisterTeacher() function is declared where record of teacher can be
stored. ViewStudentRecords() allows us to see record of student grade wise whereas
ViewTeacherRecords() function allows us to see record of teacher with their department as
well.For any mistake EditStudent() can be called to Edit detail of student using ID as
searching whereas DeleteStudent() can be initiated to delete the whole detail of student using
ID as well.Similarly EditTeacher() and DeleteTeacher() can be called to Edit or Delete detail
of teacher using CID as same instance as that of student.
printf("\nEnter Student Details:\n");
printf("ID: ");
scanf("%d", &s.ID);
printf("Name: ");
scanf(" %[^\n]s", s.Name);
printf("Address: ");
scanf(" %[^\n]s", s.Address);
printf("Phone: ");
scanf("%s", s.Phone);
printf("Email: ");
scanf("%s", s.Email);
printf("Class: ");
scanf("%d", &s.Class);
printf("Section: ");
4
scanf("%s", s.Section);
printf("Guardian Name: ");
scanf(" %[^\n]s", s.GuardianName);
printf("Guardian Phone: ");
scanf("%s", s.GuardianPhone);
Lastly, The given code is in the do.. .while loop so it can only be exited if and only if no 9 is
given which exits the program or there is Error in File Handling. The File Handling checks
the opening and closing of a file for all instances . Furthermore temp file is used for changes
and is immediately removed during the execution of the program so no duplication is
allowed.
FILE *fp = fopen("students.txt", "a");
if (fp == NULL) {
printf("ERROR: Unable to open file.\n");
return 1;
}
#include <stdio.h>
#include <string.h>
// Student Structure
struct student {
int ID;
char Name[100];
char Address[100];
char Phone[15];
char Email[50];
int Class;
char Section[5];
char GuardianName[100];
char GuardianPhone[15];
5
};
// Teacher Structure
struct teacher {
int CID;
char Name[100];
char Department[100];
char Phone[15];
char Email[50];
float Salary;
int Experience;
char Address[100];
};
// Function Declarations
int RegisterStudent();
int RegisterTeacher();
int ViewStudentRecords();
int ViewTeacherRecords();
int EditStudent();
int DeleteStudent();
int EditTeacher();
int DeleteTeacher();
int main()
{
int choice;
do {
printf("\n1. Register Student\n2. Register Teacher\n3. View Student Records\n4. View
Teacher Records\n5. Edit Student Data \n6.Delete Student Data\n7.Edit Teacher Data\n
8.Delete Teacher Data \n9. Exit\n");
printf("Enter your choice: ");
scanf("%d", &choice);
6
switch (choice) {
case 1:
RegisterStudent();
break;
case 2:
RegisterTeacher();
break;
case 3:
ViewStudentRecords();
break;
case 4:
ViewTeacherRecords();
break;
case 5:
EditStudent();
break;
case 6:
DeleteStudent();
break;
case 7:
EditTeacher();
break;
case 8:
DeleteTeacher();
break;
case 9:
printf("Exiting the program.\n");
break;
default:
printf("Invalid choice. Try again.\n");
}
} while (choice !=9 );
7
return 0;
}
8
printf("Guardian Phone: ");
scanf("%s", s.GuardianPhone);
fclose(fp);
}
9
scanf("%f", &t.Salary);
printf("Experience (in years): ");
scanf("%d", &t.Experience);
printf("Address: ");
scanf(" %[^\n]s", t.Address);
fclose(fp);
}
struct student s;
printf("Grade wise list");
while (fread(&s, sizeof(struct student), 1, fp)) {
for (int i=0;i<=12;i++)
{
if(s.Class==i)
{
printf("GRADE %d\n",i);
printf("\nID: %d\nName: %s\nAddress: %s\nPhone: %s\nEmail: %s\nClass: %d\
nSection: %s\nGuardian Name: %s\nGuardian Phone: %s\n",
s.ID, s.Name, s.Address, s.Phone, s.Email, s.Class, s.Section, s.GuardianName,
s.GuardianPhone);
}
10
}
}
fclose(fp);
}
struct teacher t;
printf("\nAll Teacher Records:\n");
while (fread(&t, sizeof(struct teacher), 1, fp)) {
printf("\nCID: %d\nName: %s\nDepartment: %s\nPhone: %s\nEmail: %s\nSalary: %.2f\
nExperience: %d years\nAddress: %s\n",
t.CID, t.Name, t.Department, t.Phone, t.Email, t.Salary, t.Experience, t.Address);
}
fclose(fp);
}
// Function to Edit a Student Record
int EditStudent() {
FILE *fp, *temp;
struct student s;
int ID, found = 0;
fp = fopen("students.txt", "r");
if (fp == NULL) {
printf("No student records found.\n");
return 1;
11
}
12
}
fclose(fp);
fclose(temp);
if (found==1) {
remove("students.txt");
rename("temp.txt", "students.txt");
printf("Student record updated successfully.\n");
} else {
remove("temp.txt");
printf("Student ID not found.\n");
}
}
fp = fopen("students.txt", "r");
if (fp == NULL) {
printf("No student records found.\n");
return 1;
}
13
printf("Enter Student ID to Delete: ");
scanf("%d", &ID);
fclose(fp);
fclose(temp);
if (found==1) {
remove("students.txt");
rename("temp.txt", "students.txt");
} else {
remove("temp.txt");
printf("Student ID not found.\n");
}
}
fp = fopen("teachers.txt", "r");
if (fp == NULL) {
printf("ERROR AT OPENING TEACHER FILE\n");
return 1;
14
}
15
fclose(fp);
fclose(temp);
if (found==1) {
remove("teachers.txt");
rename("temp.txt", "teachers.txt");
printf("Teacher record updated successfully.\n");
} else {
remove("temp.txt");
printf("Teacher CID not found.\n");
}
}
fp = fopen("teachers.txt", "r");
if (fp == NULL) {
printf("No teacher records found.\n");
return 1;
}
16
while (fread(&t, sizeof(struct teacher), 1, fp)) {
if (t.CID == CID) {
found = 1;
printf("Teacher CID: %d deleted successfully.\n", t.CID);
} else {
fwrite(&t, sizeof(struct teacher), 1, temp);
}
}
fclose(fp);
fclose(temp);
if (found==1) {
remove("teachers.txt");
rename("temp.txt", "teachers.txt");
}
else {
remove("temp.txt");
printf("Teacher CID not found.\n");
}
}
17
1.6 Testing And Resulting
SYSTEM DESIGN
18
2. Library Management System
2.1 Introduction
In the Library Management System a Main Screen is there from which we can choose
whether to add or lend a book as well as search the book and who is using it easily. We can
also see which books are lended to other people which are not and are able to easily access
the return the book function as well.
All of the function requires the book Id for implementing the add ,lend,search function in the
given program.
Before I started the project I used some example shown in our textbook “TEXTBOOK OF
COMPUTER SCIENCE” by Dr. Rupendra Man Rajkumar and his example for the given
work in “SCHOOL MANAGEMENT SYSTEM” especially on his work in File Handling
with Structure Program for better understanding of this project.
19
2.4 Implementation
1. Main Menu:
2. Add Book:
Prompts the user for the book ID, name, and author.
message.
3. Lend Book:
prompts the user for the borrower's name, ID, and date,
20
found, writes the record to 'temp.txt' as is.Closes both files.If a match was found, deletes
'Library.txt' and renames 'temp.txt' to 'Library.txt'.If no match was found, deletes
'temp.txt'.Displays the appropriate success or error message.
4. Search Book:
Prompts the user for the book ID.Opens the 'Library.txt' file in
.If a match is found, resets the borrower details in the book record
.Writes the updated record to 'temp.txt'.If no match is found, writes the record to 'temp.txt' as
is.Closes both files.
21
.Checks if the book has a borrower ID
#include <stdio.h>
#include <string.h>
// Structure definition
struct books {
int ID;
char Book[20];
char Author[20];
int IDBorrower;
char Borrower_Name[40];
char Date[10];
};
// Function prototypes
int Add_Books();
int Books_Taken();
int Search_Books();
int Book_Returned();
int Books_Not_Returned();
int main() {
int a;
do {
22
printf("\nENTER\n1. ADD BOOK\n2. Book Lend\n3. Search Book\n4. Return Book\n5.
Lended Book\n6. Exit\n");
printf("Your choice: ");
scanf("%d", &a);
switch (a) {
case 1: Add_Books(); break;
case 2: Books_Taken(); break;
case 3: Search_Books(); break;
case 4: Book_Returned(); break;
case 5: Books_Not_Returned(); break;
case 6:
printf("Exiting the program.\n");
break;
default:
printf("Invalid choice. Please try again.\n");
}
} while (a != 6);
return 0;
}
23
printf("Enter name of the author: ");
scanf(" %[^\n]%*c", book.Author);
int found = 0;
while (fscanf(fp, "%d\t%[^\t]\t%[^\n]\n", &book.ID, book.Book, book.Author) != EOF) {
if (book.ID == Id) {
found = 1;
printf("Enter borrower's name: ");
24
scanf(" %[^\n]%*c", book.Borrower_Name);
printf("Enter borrower's ID: ");
scanf("%d", &book.IDBorrower);
printf("Enter date (DD/MM/YYYY): ");
scanf(" %[^\n]%*c", book.Date);
fprintf(tempFile, "%d\t%s\t%s\t%d\t%s\t%s\n", book.ID, book.Book, book.Author,
book.IDBorrower, book.Borrower_Name, book.Date);
} else {
fprintf(tempFile, "%d\t%s\t%s\n", book.ID, book.Book, book.Author);
}
}
fclose(fp);
fclose(tempFile);
if (found == 1) {
remove("Library.txt");
rename("temp.txt", "Library.txt");
printf("Book lent successfully.\n");
} else {
remove("temp.txt");
printf("Book with ID %d not found.\n", Id);
}
return 0;
}
// Search a book
int Search_Books() {
int ID;
struct books book; // Declare an instance of the books structure
25
scanf("%d", &ID);
// If no match is found
}
// Function to display books that have not been returned
26
int Books_Not_Returned() {
FILE *fp = fopen("Library.txt", "r");
if (fp == NULL) {
printf("Error opening file.\n");
return 1;
}
// Loop through the file and check for books that are still borrowed
while (fscanf(fp, "%d\t%[^\t]\t%[^\t]", &book.ID, book.Book, book.Author) != EOF) {
if (fscanf(fp, "\t%d\t%[^\t]\t%[^\n]\n", &book.IDBorrower, book.Borrower_Name,
book.Date) == 3) {
// Book is still borrowed
found = 1;
printf("%d\t%s\t%s\t%d\t%s\t%s\n", book.ID, book.Book, book.Author,
book.IDBorrower, book.Borrower_Name, book.Date);
}
}
if (found == 0) {
printf("No books are currently borrowed.\n");
}
}
int Book_Returned()
{
int Id = 0;
27
printf("Enter ID of the book: ");
scanf("%d", &Id);
fclose(fp);
fclose(temp);
28
if (found == 1) {
remove("Library.txt");
rename("temp.txt", "Library.txt");
return 0;
} else {
remove("temp.txt");
printf("Book with ID %d not found.\n", Id);
return 1;
}
}
29
2.6 Testing And Resulting
30
3.TIC TAC TOE
3.1 Introduction
Tic-Tac-Toe is a classic two-player game, often played on a 3x3 grid. The objective is to get
three of your marks (either an "X" or an "O") in a row, either horizontally, vertically, or
diagonally. Players take turns placing their marks on the grid, with one player using "X" and
the other using "O." The game ends when one player achieves three marks in a row or all grid
spaces are filled, resulting in a draw if no one wins.
31
3.3 System Design
3.4 Implementation
The main() function is the entry point of the Tic Tac Toe game.It initializes the game by
setting the initial player, input, and status variables.The printBoard() function is called to
display the initial game board.The game loop continues until a win or draw condition is
met.Inside the game loop:The current player is determined,
and their mark ('X' or 'O') is set.The player is prompted for input,
and the input is validated.
The board is updated with the
player's mark.
The printBoard() function is called to display the updated board.
32
The checkWin() function is called to check for a win or draw condition.
The game result is handled, and the player is incremented for the next turn.
2. PrintBoard:
The printBoard() function is responsible for
clearing the screen and printing the Tic Tac Toe board
.It prints the game header, followed by the
three rows of the board, using the values stored in the board array.
3. CheckWin:
The checkWin() function checks for a win or draw condition.
It first checks for horizontal, vertical,
and diagonal wins by iterating through the
predefined winning combinations.
If a winning combination is found, the
function returns 1 to indicate a win.
If no winning combination is found,
the function checks for a draw by iterating through the board cells and ensuring that all cells
are either 'X' or 'O'.If a draw is detected, the function returns 0.If the game is still ongoing,
the function returns -1.
#include <stdio.h>
#include <conio.h>
// Function prototypes
void printBoard();
int checkWin();
void system();
33
char board[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'};
// Main function
void main() {
// Initialize variables
int player = 1, input, status = -1;
// Game loop
while (status == -1) {
// Switch player
player = (player % 2 == 0) ? 2 : 1;
// Determine the player's mark (X or O)
char mark = (player == 1) ? 'X' : 'O';
34
int result = checkWin();
35
// Winning combinations
int winConditions[8][3] = {
{1, 2, 3}, {4, 5, 6}, {7, 8, 9}, // Horizontal
{1, 4, 7}, {2, 5, 8}, {3, 6, 9}, // Vertical
{1, 5, 9}, {3, 5, 7} // Diagonal
};
36
3.6 Testing And Result
37
4. Bus Management System
4.1 Introduction
Before I started the project I used some example shown in our text book “TEXTBOOK OF
COMPUTER SCIENCE” by Dr. Rupendra Man Rajkumar and his example for the given
work in “SCHOOL MANAGEMENT SYSTEM” especially on his work in File Handling
with Structure Program for better understanding of this project.
38
4.4 Implementation
1. MainMenu:
This subgraph represents the main menu of the Bus Reservation System.It displays the
available options (Add Bus, View Buses, Book a Seat, Exit) and prompts the user to make a
choice.Based on the user's choice, it navigates to the corresponding subgraphs (AddBus,
ViewBuses, BookSeat, Exit).
2. AddBus:
This subgraph handles the process of adding a new bus to the system.It prompts the user to
enter the bus ID, driver name, and total seats.
It initializes the booked seats to 0.It opens the 'buses.txt' file in append mode and writes the
bus details to the file.Finally, it displays a success message.
3. ViewBuses:
This subgraph is responsible for displaying the list of buses.It opens the 'buses.txt' file in read
mode and checks if the file exists.If the file exists, it displays the table header and reads the
bus details from the file, displaying them to the user.If the file does not exist, it displays a
message indicating that no buses are found.
39
4. BookSeat:
This subgraph handles the process of booking a seat on a specific bus.It prompts the user to
enter the bus ID to book a seat.It opens the 'buses.txt' file in read mode and checks if the file
exists.If the file exists, it creates a temporary file 'temp.txt' and reads the bus details from the
original file.It checks if the bus with the provided ID is found.If the bus is found, it prompts
the user to enter the number of seats to book and updates the booked seats accordingly.It then
writes the updated bus details to the temporary file, closes both files, and replaces the original
file with the temporary file.If the bus is not found or an error occurs, it displays an
appropriate error message.
5. Exit:
This subgraph represents the exit point of the Bus Reservation System.When the user chooses
to exit, the program terminates.
struct Bus {
int bus_id;
char driver_name[50];
int total_seats;
int booked_seats;
};
// Function prototypes
int addBus();
int viewBuses();
40
int bookSeat();
FILE *file;
int main() {
int choice;
while (1) {
printf("\n=== Bus Reservation System ===\n");
printf("1. Add Bus\n");
printf("2. View Buses\n");
printf("3. Book a Seat\n");
printf("4. Exit\n");
printf("Enter your choice: ");
scanf("%d", &choice);
switch (choice) {
case 1:
addBus();
break;
case 2:
viewBuses();
break;
case 3:
bookSeat();
break;
case 4:
printf("Exiting the program.\n");
exit(0);
default:
printf("Invalid choice. Please try again.\n");
}
}
return 0;
}
int addBus() {
struct Bus bus;
printf("Enter Bus ID: ");
scanf("%d", &bus.bus_id);
printf("Enter Driver's Name: ");
scanf("%s", bus.driver_name);
printf("Enter Total Seats: ");
scanf("%d", &bus.total_seats);
bus.booked_seats = 0; // Initially, no seats are booked
41
file = fopen("buses.txt", "a");
if (file == NULL) {
printf("Error opening file!\n");
return 1;
}
fprintf(file, "%d %s %d %d\n", bus.bus_id, bus.driver_name, bus.total_seats,
bus.booked_seats);
fclose(file);
printf("Bus added successfully!\n");
}
int viewBuses() {
struct Bus bus;
file = fopen("buses.txt", "r");
if (file == NULL) {
printf("No buses found!\n");
return 1;
}
printf("\nList of Buses\n");
printf("ID\tDriver\tTotal Seats\tBooked Seats\n");
printf("----------------------------------------\n");
while (fscanf(file, "%d %s %d %d", &bus.bus_id, bus.driver_name, &bus.total_seats,
&bus.booked_seats) != EOF) {
printf("%d\t%s\t%d\t%d\n", bus.bus_id, bus.driver_name, bus.total_seats,
bus.booked_seats);
}
fclose(file);
}
int bookSeat() {
int bus_id, seats_to_book, found = 0;
struct Bus bus;
FILE *tempFile;
42
if (tempFile == NULL) {
printf("Error opening temporary file!\n");
fclose(file);
return 1;
}
fclose(file);
fclose(tempFile);
if (found) {
remove("buses.txt");
rename("temp.txt", "buses.txt");
} else {
printf("Bus with ID %d not found!\n", bus_id);
remove("temp.txt");
}
43
5. Telecom Billing Systems
5.1 Introduction
Telecom billing system improves the data collection technique and helps the admins control
the billing system well. It has the following advantages:
Telecom billing systems help ensure customer satisfaction.
They help reduce manual errors and aint billing disputes.
44
They help accelerate payment collections.
They help improve the customer experience.
The telecom billing system so given in the project can do the following tasks:
Add New Record: Add new customer record.
View List of Records: View all the records at a glance.
Modify Record: Modification of an already existing record.
View Payment: View the bill for a given customer.
Delete Record: The deletion of a record from the memory.
45
5.3 System design
5.4 Implementation
int addRecord()
{
if (customerCount < 100) {
printf("\nEnter name: ");
scanf(" %[^\n]s", customers[customerCount].name);
printf("Enter phone number: ");
scanf("%s", customers[customerCount].phoneNumber);
printf("Enter usage (in minutes): ");
scanf("%f", &customers[customerCount].usage);
customers[customerCount].totalBill
= customers[customerCount].usage * 0.1;
customerCount++;
46
printf("\nRecord added successfully!\n");
}
else {
printf("\nMaximum number of records reached!\n");
}
return 0;
}
addRecord() is a function to add new customer record. It checks if the current number of
customers given by customerCount is less than 100 ensuring there’s space for a new
record. The function prompts the user to enter the customer’s name, phone number,
usage in minutes. It calculates the total bill for the customer by multiplying their usage
in minutes by 0.1. After adding the record, customerCount is incremented by 1.If
maximum records is reached then it notifies the user.
viewRecords() function
int viewRecords()
{
printf("\nName\tPhone Number\tUsage(min)\tTotal "
"Bill($)\n");
for (int i = 0; i < customerCount; i++) {
printf("%s\t%s\t%.2f\t\t%.2f\n", customers[i].name,
customers[i].phoneNumber, customers[i].usage,
customers[i].totalBill);
}
}
The function named viewRecords() is responsible for displaying the list of customer
records. It uses a loop to iterate through each customer record .Within the loop, it prints the
name, phone number, usage in minutes, and total bill for each customer.
int searchRecord(char phoneNumber[]) {
printf("\nName\tPhone Number\tUsage(min)\tTotal Bill($)\n");
for (int i = 0; i < customerCount; i++) {
if (strcmp(customers[i].phoneNumber, phoneNumber) == 0) {
printf("%s\t%s\t%.2f\t\t%.2f\n", customers[i].name, customers[i].phoneNumber,
customers[i].usage, customers[i].totalBill);
return;
}
}
printf("\nRecord not found!\n");
}
This function searchRecord responsible for searching for a customer record based on their
phone number. It takes a char array phoneNumber as a parameter which is used to identify
the customer. It uses a loop to iterate through each customer record. Within the loop it
checks if the phone number of the current customer matches the provided phoneNumber. If
a matching phone number is found it prints the information of the customer including name,
phone number, usage in minutes, total bill. It displays output to the user either displaying
the customer record or informing them if the record was not found.
47
5.5 Source code
#include <stdio.h>
#include <string.h>
struct Customer
customers[100]; // Array to store customer data
int customerCount = 0; // Variable to keep track of the
// number of customers
int main()
{
int choice;
char phoneNumber[15];
while (1) {
displayMenu();
printf("Enter your choice: ");
scanf("%d", &choice);
switch (choice) {
case 1:
addRecord();
break;
case 2:
viewRecords();
break;
case 3:
printf(
"\nEnter phone number to modify record: ");
scanf("%s", phoneNumber);
modifyRecord(phoneNumber);
break;
case 4:
printf(
"\nEnter phone number to view payment: ");
48
scanf("%s", phoneNumber);
viewPayment(phoneNumber);
break;
case 5:
printf(
"\nEnter phone number to delete record: ");
scanf("%s", phoneNumber);
deleteRecord(phoneNumber);
break;
case 6:
return 0;
default:
printf("\nInvalid choice! Please try again.\n");
}
}
return 0;
}
49
for (int i = 0; i < customerCount; i++) {
printf("%s\t%s\t%.2f\t\t%.2f\n", customers[i].name,
customers[i].phoneNumber, customers[i].usage,
customers[i].totalBill);
}
}
50
{
for (int i = 0; i < customerCount; i++) {
if (strcmp(customers[i].phoneNumber, phoneNumber)
== 0) {
for (int j = i; j < customerCount - 1; j++) {
customers[j] = customers[j + 1];
}
customerCount--;
printf("\nRecord deleted successfully!\n");
return 1;
}
}
printf("\nRecord not found!\n");
}
51
5.6 Testing and results
52
53
6. Conclusion
The School Management System developed as part of this project demonstrates the effective
use of file handling and structured programming in C. The system enables efficient
management of both student and teacher data, including functionalities for adding, viewing,
editing, and deleting records. By automating these tasks, it significantly reduces manual
effort and ensures better organization of information, making it a practical solution for school
administration.
For future improvements, the system can be enhanced by adding advanced features such as a
sorting function. This would allow users to sort records based on parameters like name, ID,
class, or experience, further improving data accessibility and usability. Such enhancements
would make the system more dynamic and user-friendly, catering to the growing needs of
educational institutions
The Library Management System developed in this project showcases an efficient approach
to managing books and borrower records using file handling and structured programming in
C. It simplifies core library functions such as adding books, lending books, searching for
records, returning books, and viewing borrowed items. By automating these operations, the
system reduces manual work and enhances the overall efficiency of library management.
For future improvements, the system can be expanded by incorporating a fine calculation
function. This feature would allow the system to track overdue books and calculate fines
based on the delay, ensuring accountability and timely returns. Such an addition would make
the system more comprehensive and beneficial for both librarians and users.
The Tic Tac Toe game implemented in this project highlights the fundamentals of structured
programming and interactive user input. This classic two-player game is simple yet engaging,
allowing players to compete on a 3x3 grid with real-time updates and a winning condition
check. The game successfully demonstrates the use of arrays, control structures, and modular
programming to create a fun and functional application.
For future enhancements, the game can be upgraded by adding a "1-Player Mode" that
enables a player to compete against the computer. This would involve implementing an AI
function to determine the computer's moves, ranging from simple random placement to more
strategic algorithms.
54
6.4 Bus Management Sytem
The Bus Management System developed in this project efficiently manages bus schedules,
bookings, and passenger information. It allows users to add buses, view details, and book
seats while maintaining accurate records of available and booked seats. By automating these
processes, the system reduces manual errors and ensures a seamless experience for both
operators and passengers. Its user-friendly interface and straightforward functionality make it
a valuable tool for modernizing transportation management.
For future enhancements, the system can incorporate advanced features such as online
payment integration, route optimization, and dynamic seat allocation based on user
preferences. Adding a feature to generate booking reports and analytics would also help
operators make informed decisions and improve operational efficiency. These improvements
would make the system more comprehensive, adaptable, and beneficial for users and
administrators alike.
The Telecom Billing System developed in this project provides an efficient way to manage
customer billing processes, including generating bills, tracking usage, and maintaining
payment records. The system ensures accuracy and minimizes manual errors, making the
billing process streamlined and reliable. Its simplicity and effectiveness make it a practical
tool for telecom service providers to handle customer accounts and transactions efficiently.
For future upgrades, the system can be enhanced by integrating an online payment feature.
This would allow customers to pay their bills directly through the system using various
payment methods, such as credit/debit cards, digital wallets, or bank transfers. Such an
addition would provide convenience for customers, reduce delays in payment processing, and
further enhance the system's utility and efficiency.
55
7. Reference
Geekforgeeks
TEXTBOOK OF COMPUTER SCIENCE by Dr. Rupendra Man Rajkumar
W3C School
StackOverflow
56