C PROGRAMMING
MULTIPLE CHOICE QUESTION
OLD QUESTION BANK
SAMPLE QUESTION 2080 AND SOLUTION

C PROGRAMMING PROJECT LIST 

1. Calender Project in C

Watch Demo Video

2. Digital Diagnosis Prototype in C 

This program delivers the probability of disease you may be suffering from. This prototype version asks the user several symptoms to answer in 0 or 1. Based on the answers, the program identifies the disease. Covid-19, Pneumonia, common cold, flu, and allergy are the only diseases in this prototype program. Instead of using if-else statements that will show certain diseases only if the exact input is met, this program uses RESIDUAL SUM OF SQUARES (RSS), a mathematical-statistical formula that helps find variance. This formula compares a mean value(input of user) with the values of individual diseases and gives us the variance. Then the disease that least varies with the mean data is shown as a result. This program works similar to the world-famous game "akinator" which guesses which celebrity, animal or object you have in your mind based on some questions that the user has to answer.

Watch Demo Video

3. Election Management in C 

Our project entitled "Election management system". It is actually a menu driven program where the user can vote according to their wish. We have made use of different library functions as well as user define function. We have introduced the counter variables which counts the number of votes of each representative. When someone votes for a specific party then the vote counter variable of respective party increases by one. Well for this program we used our own names as representative. On demand of the user, number of votes of each representative can be viewed and leaderboard can be accessed.

Watch Demo Video

4. Tic-Tac-Toe in C

Watch Demo Video

5. Personal Diary Management System in C

In this system, a user can simply add their daily details safely and efficiently as it is not time consuming at all. Every section mentioned in the Personal Diary Management System is indulged with a high security so there is no chance of data loss at all. There is maximum privacy to the files and data recorded in the system. The whole project is designed in C language and in it different variables and strings have been used for the development of this project. We have managed to design a simple project in C forming a Personal Diary Management System built in it as a console application without the usage of any graphic features. It is easy to operate and understand by the users of it and is designed in such a way that the user will not find it difficult at all to use and navigate.

Watch Demo Video

6. Snake Game in C

 

Snake became famous from 8-bit gaming environment and still today it is been upgraded to many platforms including latest HTML 5 based websites. In this project, we have developed a console-based Snake game controlled using Keyboard inputs. This game attempts to refresh the old memories of classic snake game and brings up new experience with the implementation of entry level Artificial Intelligence. The game can be played by all age groups and can be found entertaining. The objective of the game is to increase snake's length by consuming the food, which will appear regularly on the console. Boosts will also appear randomly and will help the snake move faster. However, boosts will disappear after a short amount of time. A decay element is also present in the game, which makes the snake lose a fragment of itself if food is not eaten for a long duration of time.

Watch Demo Video 1

Watch Demo Video 2

7. Student Record Management in C 

Student Record Management is a small project based on C programming prepared by student of chemical department. In this program student detail can be saved modified and extract if needed .

Watch Demo Video

8. The Quiz Game 

Watch Demo Video

9. Bus Ticket Reservation System in C 

The project "BUS TICKET RESERVATION SYSTEM " is the sample project for booking tickets for bus using the c language. .The main aim of this project is to develop easy and convenient way to reserve tickets. The following are the features included in this program: Login System with validations Easy ticket reservations View the arrival and departure time of buses Systematic presentation of bus information This entire program is based on a concept to reserve bus tickets of various destinations. Here, as the program is executed, there’s a login system that checks the validity of user. Then the user has to choose between reserving a ticket or viewing all the available bus along with their route, time of departure and fare of the journey. By choosing reservation of ticket, user has to enter his/her name, number of tickets he/she wants to book and then choose by which bus to travel according to their destination. Then the system will ask for ticket confirmations. User can also view full list of all the bus available. This whole project is designed in ‘C Programming language’ and various functions, variables and strings have been used for the development. It is easy to operate and understand.

Watch Demo Video

10. ATM Banking in C

IN this project named ATM BANKING we have introduced header file stdio.h windows.h time.h along with switch statement. switch statement used in this project allows user to access various option like .BALANCE INQUIRY .CASH WITHDRAWL .CASH DEPOSIT

Watch Demo Video

11. Movie Ticket Booking System in C

"THE THEATRE C" is a very user friendly project written in C programming language. About the project This is a movie ticket booking system. A user can simply book a ticket of an ongoing movie in the theatre from home. The interface is made very easy and friendly. There are two modes in the program. Admin mode and the user mode Admin mode: To access the admin mode there is a special password and admin can only enter the mode. He/she can add different movies, can see all the transcactions and details of all the users using the platform. User mode: User can create an account in the program and later sign in with that account. After signing in he/she can book a ticket. The user can see which movies are available and select their favourite one. The available seats for the movie is displayed in the screen and the user can book the seats. User can add their details and book tickets.

Watch Demo Video

12. Mini Soduko Solver 

The project is called “Mini-Sudoku Solver”.It solves the mini sudoku puzzles of 4*4 board i.e 4 rows, 4 columns and 2*2 cells.We defined various functions to make the code easier to understand ,maintain and debug.The program first checks the rows then columns and then 2*2 cells respectively and replaces 0s with the correct values(1-4).

Watch Demo Video

13. Student Management System in C

For an engineering student, performing projects help in development of their skills and thinking capacity. So we have created our first project “STUDENT MANAGEMENT SYSTEM” with the help of C programming language. The program works in the basis of two accounts: admin and user. The 'admin' account can have access to all the features such as View/Filter, Add, Edit, Delete and Search student record and add, delete and view user accounts through admin panel. Similarly, the 'user' account has access to only View/Filter and Search record. The main objective of the project was to create user friendly design based program.

Watch Demo Video 1

Watch Demo Video 2

14. Fibonacci 2048 in C

 

1.1 About Game:

1.1.1 Introduction:

2048 is a single player puzzle game which went viral earlier in the year 2014 on PlayStore. It was created by a 19 year old Italian web designer, Gabriele Cirulli. Fibonacci 2048 is a modification of 2048, introducing the Fibonacci Sequence. The Fibonacci Sequence is defined by the recursion, Fi+1 = Fi + Fi−1 , for i ≥ 2 with the initial two terms being F1 = 1, F2 = 1. The objective of the game is to create a tile with the number F12 = 144 on the 4 × 4 playing grid.

1.1.2 Gameplay:

Fibonacci 2048 is played on a 4 × 4 grid, with numbered tiles which slide smoothly across rows and columns when the player moves them using the four arrow keys. The game begins with only two tiles on the board, each of whose values are either 1 or 2. Each turn, a new tile will randomly appear in an empty spot on the board with value either 1 or 2. The tiles slide as far as possible in the chosen direction until they are stopped by either another tile or the boundary of the grid. The numbers on the tiles are terms of the Fibonacci Sequence. If two tiles which are consecutive terms of the Fibonacci Sequence collide, i.e, if Fk and Fk+1 collide, they merge into a single tile with the number Fk+2. The new tile formed cannot merge with another tile in the same move. You win the game when a tile with the number F12 = 144 is created; however you can continue playing to create tiles with larger numbers. When the player cannot make a legal move, i.e, there are no empty cells on the grid and no adjacent tiles with consecutive terms of the sequence, the game ends.

1.1.3 Controls:

You may slide tiles in either of the four directions, North, South, East or West.

Watch Demo Video

15. Hangman Game in C

This is a command line hangman game we made as our project This project works perfectly for linux while for windows there may be some slight tweaks needed. The source code for the project in Windows will also be added in the below given github link. We tried our best to make it as fun as possible and hope you'll like it. The words area randomly generated from the file wordlist.txt and the player is given chances equal to the length of the word. Since the word length are constantly changing with each game it was not possible to animate the hangman with each wrong choice. So the hangman is animated when the player win and it also plays different sounds depanding upon the player has won or lost. And there is another prompt which asks whether you want to continue or not.

Watch Demo Video 1

Watch Demo Video 2

16. Love Calculator using C

This project is given to us as project making assignment and to increase our self logic development capabilities in coding for C programming. We have decided to make “love calculator” which we thought is more feasible during this situation. We have used different data types in this project. Some of them are string, integers. We have also introduced looping concept by including “for loop”,string handling function like strlen().

Watch Demo Video

17. BMI Calculator 

INTRODUCTION

The project I present here is entitled as BMI , it is a simple project that calculates the BMI (Body Mass Index) of the user . BMI introduced in the early 19TH century by Lambert Adolphe Jacques Quetelatm, a Belgian mathematician gave this concept as an easy way to check the degree of obesity of human population and WHO has been using the BMI as the standard for recording obesity statics since the early 1980s. Thus, the program is a convenient rule of thumb to check the physical state of people considering height and weight.

METHODOLOGY The core concept used in the program is simple mathematics that BMI is the division of body weight by height in square. The program begins with greetings then asks the user if they want to check their BMI or not, if the user wills to check his/her BMI the code proceeds as ; program asks users for their respective age, weight and height and after data is entered it displays their BMI value and checks the BMI of the user is under which state viz underweight ,normal , overweight , obese.

Watch Demo Video

18. Minimalogic - a simple digital logic simulator made in C

Minimalogic is a simple digital logic simulator made in C using SDL2 as a project for completion of the course Computer Programming [CT 401]. It was coded with a specific objective of getting the simulation job done easily, the curiosity emanated from our regular Digital Logics lab. It is a GUI based logic simulator of x64 Windows systems that allows simulation of various logic gates and circuits. It allows users to create and simulate circuits ranging from a simple 1-bit adder to more complex circuits like 4-bit counters. In fact, one can create any circuit that fits within the available area using the components provided in the program. The program allows the user to interact via mouse and keyboard. To make the program user friendly, we tried to keep the controls as intuitive as possible.

Watch Demo Video

19. Chess Game with Bot Opponent(Carl's son) using C

Watch Demo Video

20.Scientific Calculator using C

Watch Demo Video

21. Lets Learn C- Mini Projecr

Watch Demo Video

22. A World of Game using C

Watch Demo Video

23. Library Management System 

Watch Demo Video

//documentation section//
//* Library management system
//MEMBERS:
//1.	Anshu Bhusal              (079BCH011)
//2.	Anjali Bhattarai          (079BCH009)
//3.	Kelina Shahi              (079BCH023)
//4.	Miraj Shrestha            (079BCH027)
//5.  Prashuna Basnet           (079BCH033)
//6.  Sneha Khatri              (079BCH044)

//Date: 2023/8/4 */


//link section//
#include<stdio.h>//for standard functions
#include<string.h>//for string handling functions
#include<stdlib.h>//for using :exit(); and system("cls"); functions
#include<conio.h>//for using :getch(); function


//definition section//
#define clrscr(); system("cls"); //Is to be done in VS code(modern C complier) in older compliers it is pre defined in header file #include<conio.h>.


//global declaration section//
FILE *f;//for storing information of books
FILE *lp;//for storing login information
struct library1//for storing book information
{
    char book_title[100];
    char author_name[100];
    int  acc ;
    char category[20];
    char sname[50];
    char sroll[50];
    int day,month,year;
}library;
struct login{//for storing login information
    char username[50];
    char password[50];
}l;
char filename[30];//for storing file name


//function prototyping//
void headMessage(char *);
void welcomeMessage();
void init();//loading login credentials
void login();//log in process
void mainmenu();//main part of program for managing library management
void update();//update login credentials
void add_book();//adding book information in file
void disp_book();//displaying book information from file
void delete_book();//deleting book information from file
void search();//searching book information from file
void modify();//modifing book information in file

// main() function section//
int main()
{
	init();	
    welcomeMessage();
    login();	
	return 0;
}


//sub program section//
void headMessage(char *message)
{
    clrscr();
    printf("\t\t\t###########################################################################");
    printf("\n\t\t\t############                                                   ############");
    printf("\n\t\t\t############      Library management System Project in C       ############");
    printf("\n\t\t\t############                                                   ############");
    printf("\n\t\t\t###########################################################################");
    printf("\n\t\t\t---------------------------------------------------------------------------\n");
    printf("\t\t\t\t\t\t%s",message);
    printf("\n\t\t\t----------------------------------------------------------------------------\n");
}

void welcomeMessage()
{
    headMessage("www.pulchowklibrarysystem.com");
    printf("\n\n\n\n\n");
    printf("\n\t\t\t  **-**-**-**-**-**-**-**-**-**-**-**-**-**-**-**-**-**-**\n");
    printf("\n\t\t\t        =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=");
    printf("\n\t\t\t        =                 WELCOME                   =");
    printf("\n\t\t\t        =                   TO                      =");
    printf("\n\t\t\t        =                 LIBRARY                   =");
    printf("\n\t\t\t        =               MANAGEMENT                  =");
    printf("\n\t\t\t        =                 SYSTEM                    =");
    printf("\n\t\t\t        =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=");
    printf("\n\t\t\t  **-**-**-**-**-**-**-**-**-**-**-**-**-**-**-**-**-**-**\n");
    printf("\n\n\n\t\t\t Enter any key to continue.....");
    getch();
}

void init()
{
	if( lp=fopen("login.txt","r")){//look if the file exist
		fread(&l,sizeof(l),1,lp);//read the credentails from file if exist
		fclose(lp);
	}
	else{
		strcpy(l.username,"bch079");//assign default crededtials if file doesn't exist
		strcpy(l.password,"maask");
	}
}

void login()
{
    int L=0;
    char bch079[50], maask[50];
    headMessage("Login Screen");
    do
	{
		printf("\n\t\t\t\tEnter Username and Password");
		printf("\n\t\t\t\tUsername:");
		scanf(" %[^\n]" ,bch079);
	
		printf("\n\t\t\t\tPassword:");
		scanf(" %[^\n]" ,maask);
		if((strcmp(bch079,l.username)==0)&& (strcmp(maask,l.password)==0))//check if the username and password are correct
		{
			printf("\n\t\t\t\tLogged Into System.");
			printf("\n\t\t\t\tPress any key to go next.....");
			printf("\n------------------------------------------------------------------------------------------------");
			getch();
			mainmenu();//calling mainmenu function if the credentials are correct
		}
		else
		{			
			printf("\t\t\t\tLogin Failed Enter Again Username & Password Again\n\n");
			L++;
		}
	}while(L<3);	

	if(L>=3){//wrong credentials multiple times
        headMessage("Login Failed");
		printf("\t\t\tSorry,Unknown User.");
		getch();
	}	
}

void mainmenu()
{
    int choice;
    strcpy(filename,"libraryrecords.txt");//giving filename
	do
    {
        headMessage("MAIN MENU");
		printf("\n\n\t\t\t1.Add Book Information");
		printf("\n\n\t\t\t2.Display Book Information");
		printf("\n\n\t\t\t3.Delete Book Records");
		printf("\n\n\t\t\t4.Search Specified Book");
		printf("\n\n\t\t\t5.Modify Book Records");
		printf("\n\n\t\t\t6.Update Login Information");
		printf("\n\n\t\t\t0.Exit");
		printf("\n\n\n\t\t\t Enter choice => ");
		scanf("%d",&choice);
		switch(choice)
		{
	    	case 1:
	    	add_book();
	    	break;
	    	case 2:
	    	disp_book();
	    	break;
	    	case 3:
			delete_book();
			break;
			case 4:
			search();
			break;
			case 5:
			modify();
			break;
			case 6:
			update();
			break;
			case 0:
            printf("\n\n\n\t\t\t\tThank you!!!\n\n\n\n\n");
            getch();
			exit(0);
			default:
            headMessage("MAIN MENU");
			printf("\t\t\tTry valid character: 0 1 2 3 4 5 6");
            printf("\n\n\n\t\t\tpress any key to continue");
            getch();
		}
	}	while(choice!=0);
}

void add_book()
{ 
	char test;
    if((f=fopen(filename,"a+"))==NULL)
    {
		printf("Cannot open the file");
		exit(1);
    }
    while(1)
    {
        headMessage("ADD NEW BOOKS");
		printf("\n\n\n\n\n\t\t\tEnter the details of the book:\n");
		fflush(stdin);//clear (or flush) the output buffer. 
		printf("\n\n\n\t\t\tName:");
		scanf(" %[^\n]",library.book_title);
		printf("\n\t\t\tAuthor:");
		scanf(" %[^\n]",library.author_name);
		printf("\n\t\t\tAccession no:");
		scanf(" %d",&library.acc );
		printf("\n\t\t\tCategory:");
		scanf(" %[^\n]",library.category);
        printf("\n\t\t\tStudent's name:");
		scanf(" %[^\n]",library.sname);
        printf("\n\t\t\tStudent's roll:");
		scanf(" %[^\n]",library.sroll);
        printf("\n\t\t\tDate of issue(day-month-year):");
		scanf(" %d-%d-%d",&library.day,&library.month,&library.year);
		fwrite(&library,sizeof(library),1,f);
		fflush(stdin);
		printf("\n\n\n\t\t\t\tEnter esc key to exit");
		test=getch();
		if(test==27)//The ASCII value of escape key (ESC) is 27.
		break;
    }
    fclose(f);
}

void disp_book()
{
	if((f=fopen(filename,"r"))==NULL)
    {
		printf("Cannot open the file");
		exit(1);
    }

    while((fread(&library,sizeof(library),1,f))==1)
    {
        headMessage("DISPLAY BOOKS DETAILS");
		printf("\n\n\t\t\tDETAILS OF BOOKS IN LIBRARY\n");
		printf("\t\t\t**************************");
		printf("\n\n\n\t\t\tName:%s\n\n\n\t\t\tAuthor:%s\n\n\n\t\t\tAccesion No:%d\n\n\n\t\t\tCategory:%s\n\n\n\t\t\tStudent's name:%s\n\n\n\t\t\tStudent's roll:%s\n\n\n\t\t\tDate of issue(day-month-year):(%d-%d-%d)"
        ,library.book_title,library.author_name,library.acc ,library.category,library.sname,library.sroll,library.day,library.month,library.year);
		getch();//Hold the screen until user press any key.
    }
    headMessage("DISPLAY BOOKS DETAILS");
	printf("\n\n\t\t\tDETAILS OF BOOKS IN LIBRARY\n");
	printf("\t\t\t**************************");
	printf("\n\n\n\n\n\n\t\t\t::No Records Available::");
    printf("\n\n\n\t\t\tpress any key to continue");
	getch();
    fclose(f);
}

void delete_book()
{
    FILE *temp;//for storing all inforamtions except the the inforamtion to be deleted
    int flag;
    int a;//for storing given accession code
    headMessage("Delete Books Details");
    printf("\n\n\n\t\t\tEnter the accession no of the book to be deleted:\n\n\t\t\t\t");
    fflush(stdin);
    scanf(" %d",&a);
	f=fopen(filename,"r");
    if(f==NULL)
    {
	    printf("Cannot open the file");
	    exit(1);
    }

    temp=fopen("tempfile","w");
    if(temp==NULL)
	{
		printf("Cannot open the file");
		exit(1);
	}
    
    flag=1;//initialized to 1
    while(fread(&library,sizeof(library),1,f)==1)
    {
        if(a==library.acc)
        {
		    flag=0;//will be 0 if the given accesion no. match
	        continue;//writing is skipped for given accession no's book informations
        }
        else
	    fwrite(&library,sizeof(library),1,temp);//temp contains all the informations except the one should be deleted
    }
    fclose(f);
    fclose(temp);
    remove(filename);//deleting the file initailly containing all the inforamtion including the one to be deleted 
    rename("tempfile",filename);//the updated file after deleting renamed as the initail file i.e updated file replacing the inital file
    
    if(flag==0)
    {
        printf("\n\n\n\t\t\tRecord Deleted");
    }
    else
    {
        printf("\n\n\n\t\t\t::No such Record::");
    }
    printf("\n\n\n\t\t\tpress any key to continue");
	getch();
}

void search()
{
    char c,name[100],roll[100];
    int flag,a;//a for storing given accession code
    f=fopen(filename,"r");
    if(f==NULL)
    {
	    printf("Cannot open the file");
	    exit(1);
    }
    headMessage("SEARCH BOOKS");
	printf("\n\n\n\n\t\t\tWhat do you know about the book?\n\n\n\n\t\t\t1. The name of the book(N/n)\n\n");
	printf("\t\t\t2. The roll of the student(R/r)\n\n\t\t\t3. The accesion code of the book(C/c)\n\t\t\t");
	printf("\n\n\n\t\t\t Enter choice => ");
	scanf(" %c",&c);
	switch(c)
	{
        case 'N':
        case 'n':
        headMessage("SEARCH BOOKS");
        printf("\n\n\n\n\t\t\tEnter the name of the book:");
        fflush(stdin);
        scanf("%[^\n]",name);
        flag=1;//flag intialized to 1
        while(fread(&library,sizeof(library),1,f)==1)
        {
            if((strcmp(library.book_title,name))==0)
            flag=0 ;//flag will be 0 if match for searched inforamtion exist
            else
            continue;
            if(flag==0)//displaying the searched  inforamtion
            {
                printf("\n\n\n\t\t\tName:%s\n\n\n\t\t\tAuthor:%s\n\n\n\t\t\tAccesion No:%d\n\n\n\t\t\tCategory:%s\n\n\n\t\t\tStudent's name:%s\n\n\n\t\t\tStudent's roll:%s\n\n\n\t\t\tDate of issue(day-month-year):(%d-%d-%d)"
                ,library.book_title,library.author_name,library.acc ,library.category,library.sname,library.sroll,library.day,library.month,library.year);
                printf("\n\n\n\t\t\tpress any key to continue");
                getch();
                headMessage("SEARCH BOOKS");
            }
	    }

        if(flag==1)
        {
            printf("\n\n\n\t\t\t::No such Record::");
            printf("\n\n\n\t\t\tpress any key to continue");
            getch();
        }
	    break;

        case 'R':
        case 'r':
        headMessage("SEARCH BOOKS");
        printf("\n\n\n\n\t\t\tRoll of the student:");
        fflush(stdin);
        scanf("%[^\n]",roll);
        flag=1;
        while(fread(&library,sizeof(library),1,f)==1)
        {
            if((strcmp(library.sroll,roll))==0)
            flag=0 ;
            else
            continue;
            if(flag==0)
            {
                printf("\n\n\n\t\t\tName:%s\n\n\n\t\t\tAuthor:%s\n\n\n\t\t\tAccesion No:%d\n\n\n\t\t\tCategory:%s\n\n\n\t\t\tStudent's name:%s\n\n\n\t\t\tStudent's roll:%s\n\n\n\t\t\tDate of issue(day-month-year):(%d-%d-%d)"
                ,library.book_title,library.author_name,library.acc ,library.category,library.sname,library.sroll,library.day,library.month,library.year);
                printf("\n\n\n\t\t\tpress any key to continue");
                getch();
                headMessage("SEARCH BOOKS");

            }
        }
        if(flag==1)
        {
            printf("\n\n\n\t\t\t::No such Record::");
            printf("\n\n\n\t\t\tpress any key to continue");
            getch();
        }
        break;

        case 'C':
        case 'c':
        headMessage("SEARCH BOOKS");
        printf("\n\n\n\n\t\t\tAccesion No:");
        fflush(stdin);
        scanf("%d",&a);
        flag=1;
        while(fread(&library,sizeof(library),1,f)==1)
        {
            if(library.acc==a)
            flag=0 ;
            else
            continue;
            if(flag==0)
            {
                printf("\n\n\n\t\t\tName:%s\n\n\n\t\t\tAuthor:%s\n\n\n\t\t\tAccesion No:%d\n\n\n\t\t\tCategory:%s\n\n\n\t\t\tStudent's name:%s\n\n\n\t\t\tStudent's roll:%s\n\n\n\t\t\tDate of issue(day-month-year):(%d-%d-%d)"
                ,library.book_title,library.author_name,library.acc ,library.category,library.sname,library.sroll,library.day,library.month,library.year);
                printf("\n\n\n\t\t\tpress any key to continue");
                getch();
                headMessage("SEARCH BOOKS");

            }
        }
        if(flag==1)
        {
            printf("\n\n\n\t\t\t::No such Record::");
            printf("\n\n\n\t\t\tpress any key to continue");
            getch();
        }
        break;

        default:
        headMessage("SEARCH BOOKS");
        printf("\n\n\t\t\tWRONG ENTRY");
        printf("\n\n\t\t\tTRY ANY VALID CHARACTER:(N,R,C)\n");
        getch();
    }
    fclose(f);
}

void modify()
{
    FILE *temp;
    int flag;
    int a;
    headMessage("MODIFY BOOKS DETAILS");
    printf("\n\n\t\t\tEnter the accession no of the book to be modified:\n\n\t\t\t\t");
    fflush(stdin);
    scanf(" %d",&a);
	f=fopen(filename,"r");
    if(f==NULL)
    {
	    printf("Cannot open the file");
	    exit(1);
    }

    temp=fopen("tempfile","w");
    if(temp==NULL)
	{
		printf("Cannot open the file");
		exit(1);
	}
    
    flag=1;
    
    while(fread(&library,sizeof(library),1,f)==1)
    {
        if(a==library.acc)
        {
		    flag=0;
	        continue;
        }
        else
	    fwrite(&library,sizeof(library),1,temp);
    }
    
    if(flag==0){
		printf("\n\n\t\t\t\t::Enter new records::");
		printf("\n\n\t\t\t\t~~~~~~~~~~~~~~");
		printf("\n\n\n\n\t\t\tBook Name: ");
		fflush(stdin);
		scanf("%[^\n]",library.book_title);
		printf("\n\t\t\tAuthor Name:");
		fflush(stdin);
		scanf("%[^\n]",library.author_name);
		printf("\n\t\t\tAccession No:",library.acc);
		fflush(stdin);
		scanf("%d",&library.acc);
		printf("\n\t\t\tCategory:",library.category);
		fflush(stdin);
		scanf("%[^\n]",library.category);
		printf("\n\t\t\tStudent's name:");
		fflush(stdin);
		scanf("%[^\n]",library.sname);
        printf("\n\t\t\tStudent's roll:");
		fflush(stdin);
		scanf("%[^\n]",library.sroll);
        printf("\n\t\t\tDate of issue(day-month-year)");
		fflush(stdin);
		scanf(" %d-%d-%d",&library.day,&library.month,&library.year);
		fflush(stdin);
		fwrite(&library,sizeof(library),1,temp);
		printf("\n\n\n\t\t\tRecord modified");
	}

    else
    printf("\n\n\n\t\t\t::No such Record::");
	fclose(f);
    fclose(temp);
    remove(filename);
    rename("tempfile",filename);
    printf("\n\n\n\t\t\tpress any key to continue");
	getch();
}

void update()
{
	lp=fopen("login.txt","w");
    if(lp==NULL)
    {
	    printf("Cannot open the file");
	    exit(1);
    }
    headMessage("Update Credential");
	printf("\t\t\tEnter new username: \t");
	scanf(" %[^\n]",l.username);
	printf("\t\t\tEnter new password: \t");
	scanf(" %[^\n]",l.password);
	fwrite(&l,sizeof(l),1,lp);
	fclose(lp);
    fflush(stdin);
	printf("\n\t\t\tUsername and Password has been changed successfully");
    printf("\n\t\t\tLogin Again:");
    getchar();
    exit(1);
}

 

C PROGRAMMING PROJECT COMPLETE PLAYLIST LINKS :

1. C PROJECT 2023

2. C PROJECT 2022

3. C PROJECT 2021

SAMPLE REPORT OF PROJECT