This is large and complete c project built for medical store management system. In this project you can keep details of customer , suppliers and medicine. You can view the report and billing information also. You can add,edit, delete and search the record also. This project is also console application without graphics compile in code::blocks IDE with MinGW compiler.
Whole project is completely based on file handling all the record are store in file. You learn how to store the data ,editing data, searching data and deleting data using file. You can see the following feature in this projects.
1. Supplier Info
2.Customer Info
3.Medicine
4.Report
5.Bill
Bank Management System project is design and programmed by Ravi Agrawal, Sagar Sharma and Sawal Maskey student of IOE as a first year mini project in c. This program may not be used as a Banking software but programmer tries to implement all the features of Bank. Program is completely password protected and has a two mode Admin and Staff mode. Bank administrator can login as admin user name is “admin” and password is “ioe” for admin mode. For staff mode three user name is available which is written in USER.DAT which you can see download this project. The list of user name and passwor for staff mode is given below:
This project is similar to the project Contact Management in C. In this project, I am reusing all the code from it. I created this Personal Diary Management project just by renaming printed messages, adding a few functions, and modifying existing functions slightly.
Please go through the Contact Management project if you haven't. In this project, I have explained the techniques of file handling in C.
So, in this project, I will explain the changes that I have made.
Let's start with describing data structure.
// Define Constant Variables
#define ESC 27
#define REF_SZ 10
#define DATE_SZ 64
#define MIN_TEXT_SZ 50
#define MAX_TEST_SZ 500
#define READ_ARRAY_SZ 15
#define DATA_FILE "dataFile.dat"
#define TEMP_FILE "tempFile.dat"
//Define data structure
struct data{
char refNum[REF_SZ]; //Unique reference number and auto-incremented
char noteDate[DATE_SZ]; //Auto populated using system date and time
char eventDate[DATE_SZ]; //Event date
char location[MIN_TEXT_SZ]; //Location of event happened
char eventDesc[MIN_TEXT_SZ]; //Event short description
char notes[MAX_TEST_SZ]; //Notes of the Event
};
I am using 6 variables in a structure. The variable "refNum" will be unique and it is auto-increment. The variable "noteDate" is to store note added date and it is also auto-populated using system date and time.
Other variables are:
eventDate: Event date. It can be any format chosen by the user
location: Location of event happened.
eventDesc: Event short description.
notes: Notes of the event. Maximum character is 500.
Although the variable refNum is auto-incremented, I haven't defined it as an integer. Rather than storing number value only, I decided to add '#R' as an initial character so that the unique reference value will look like "#R10001" instead of "1000".
To achieve this we have to create two separate small functions which I will describe below.
Function: getNextRef()
//Get next reference number
int getNextRef(){
struct data a;
int num=0;
fp = fopen(DATA_FILE,"rb");
if(fp!= NULL){
fseek(fp,0,SEEK_END);
fseek(fp,ftell(fp)-sizeof(a),0);
fread(&a,sizeof(a),1,fp);
// converting string to number
for (int i = 0; a.refNum[i + 2] != '\0'; i++) {
num = num * 10 + (a.refNum[i + 2] - 48);
}
fclose(fp);
return num;
} else {
return 10000;
}
}
This function will read the last item from the file and read the reference number which is the previous reference number and also the highest value. It will remove the first two characters, convert the remaining numbers into an integer data type, and return it. This function will be executed at the start of the application so if it does not find a file then it will return 1000.
Function: calRefNum(char *buff, int num)
//Calculate next reference number
static void calRefNum(char *buff, int num){
char tmpRef[REF_SZ];
char refNum[REF_SZ] = {'#','R'};
sprintf(tmpRef,"%d",num);
strcat(refNum, tmpRef);
strcpy(buff,refNum);
}
This function converts the reference number into char data type, concatenates with the "#R" initial character, and assigns it to a character pointer which is used while adding notes.
Apart from these changes I have made a few changes in readData(), add(), and view() functions. Once you compile and run it you will understand the changes.
This Mini project is compile in gcc compiler with code::blocks IDE. This project can be a good reference for those student who are doing there school project in c.Architecture of this project is very simple and easy to understand the code. Just file handling is used to store the data and corresponding function are made to manipulate the data.
The tasks provide in this program are:-
1. A : for adding new records.
2. L : for list of records.
3. M : for modifying records.
4. P : for payment.
5. S : for searching records.
6. D : for deleting records.
User are provide the above tasks.They can add records,modify and view records. Searching and deleting facilities is also provided. Download Project from GitHub
In code block you can use
Sleep(unsigned int miliseconds);
function for delay in execution.
delay(unsigned int miliseconds) function is used in turbo c. For codeblocks you have to add code which is given below example:
In our general program we can’t run two process at same time for e.g we can’t run two for loop at same time.For running two process at same time we need Multithreading.In C we do it by the _beginthread and
_endthread run time library function.All the above c run time library functions are in the process.h header file. Header
process.h
Prototype
unsigned long _beginthread(void(* func)(void*), unsigned stack_size, void *arg);
Cyber Management System is a program which interconnects different computers which allows users to communicate over the computer network and provide security from unauthorized users by login system in client server.
The project is based on the client server architecture and its communication protocols. The project basically is divided into two sections:- Cyber server and Client server. Not only a single, multiple client can connect to cyber server at any time. Cyber server has the full control over Client server. Client server is password protected user has to login to access internet and other services. New user can signup for username and password. Price rate and services is fixed by cyber server. Client can request any service sending message to cyber server.
In this article, we will create a contact management system in C and store data in the file. You will learn CRUD (Create, Read, Update, and Delete) operation in C files, and various modes of opening files. The main objective of this article is to give you an idea of file handling in C programming.
At the end of this article, you will learn the following items:
Break down the application into separate individual modules.
Create an application flow chart.
Convert the flow chart processes into C functions.
Learn techniques to switch between processes based on the user input.
Master the CRUD (Create, Read, Update, and Delete) operation in file handling.
You can download the final version of the application from GitHub Download from GitHub.
For a detailed explanation follow the articles below.
Chapter 1 -> Flow chart and Functions: In this article, you will learn to create a flow chart, breakdown the application into C functions, and create a Main Menu function to display options and get user input.
Hi this is a tic-tac-toe game you can copy sourcecode here or Download from GitHub.
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include <windows.h>
Welcome to the Mini Project Quiz in C! This article is about creating a simple quiz game in the C programming language. The target readers of this article are students and absolute beginner C programmers. If you are an experienced C programmer then it is not for you.
You will learn to break down an application into modules (functions), switch between screens based on user input, multi-dimensional array techniques, loops and so much more.
Like in other sample mini-projects, I have not used a file handling system to store information to make it simple and easy to understand basic techniques.
After finishing this article, you will:
Truly understand how to break down the application and create a flow chart.
Be able to convert the flow chart processes into C functions.
Learn techniques to switch between processes based on user input.
Have mastered the usages of multi-dimensional C arrays and loops.
You can download the final version of the application from GitHub Download from Github.
I have divided this article into 3 parts:
Part 1: Flow Chart and Main Menu: In this lesson, you will learn to create an application flow chart and create a welcome menu screen of the game. Part 2: Multi-dimensional C array: In this lesson, you will understand techniques to create a function and switching between multiple functions as per user choice. You will master how to use one-dimensional, two-dimensional, and three-dimensional C arrays to store questions, question options, and answers. Part 3: Gameplay and the final score: You will learn to use a loop to display questions one by one, check the user's correct answer, and calculate the final score.
You can also watch a video about this project on YouTube.
This mini project is about department store all features required for department store are added in this programe.You can copy the source code and compile it in a code block.This project is perfect for your college mini project in C. Download Project from Github
#define ANS 15
#define ACS 4
COORD coord={0,0}; // this is global variable
//center of axis is set to the top left cornor of the screen
void gotoxy(int x,int y)
{
coord.X=x;
coord.Y=y;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),coord);
}
/*declaration of checking functions*/
void c_code(char[]);
int check(char[]);
Mini project in C many Student do management project like library management ,Hotel management etc.But Snake Game is mini project of first semester build by my friend which is very different.It is console application without graphic library that's why it is more interesting.This game is perfect without any error and better user interface.It is complied in code::block using c language.Here goes a source code you can copy and compiled it in code::block.I hope it can help and become a reference for your project. Download Project from Github.
This sample application is the implementation of the clock() function available in time.h header. The time function is very useful and necessary. Some of the examples of usage of time function are:
Security applications might need to update the security keys every one minute or more.
You may need to write a function to send files to the remote server every one minute or extract files from the server every 15 minutes.
and many more.
I have created a simple digital clock to show you the implementation of clock() function. The sample code given below is written in C using codeblocks IDE on windows.
#include <stdio.h>
#include <time.h> //this is header file for time
#include <windows.h>
COORD coord = {0, 0};
void gotoxy (int x, int y)
{
coord.X = x;
coord.Y = y; // X and Y coordinates
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coord);
}
int main()
{
long i = 0; /* Loop counter */
clock_t now = 0; /* Holds initial clock time */
int interval = 1; /* Seconds interval for o/p */
int elapsed = 0;
int min=0,MIN=0,hrs=0,sec=0;
int d=0,f=0;
now = clock(); /* Get current clock time */
for(i = 0L ; ; i++)
{
elapsed = (clock()-now)/CLOCKS_PER_SEC;
if(elapsed>=interval)
{
interval += 1;
if(elapsed%60==0)
{
min=elapsed/60;
d=60*min;
if(min%60==0)
{
hrs=min/60;
f=60*hrs;
}
}
sec=elapsed-d;
MIN=min-f;
if(hrs<10)
{
gotoxy(2,4);
printf("0%d",hrs);
}
else
{
gotoxy(2,4);
printf(":%d",hrs);
}
if(min<10)
{
gotoxy(4,4);
printf(":0%d",MIN);
}
else
{
gotoxy(4,4);
printf(":%2d",MIN);
}
if(sec<10)
{
gotoxy(7,4);
printf(":0%d",sec);
}
else
{
gotoxy(7,4);
printf(":%2d",sec);
}
gotoxy(7,7);
printf("%dhrs:%dmin:%dsec",hrs,MIN,sec);
}
}
return 0;
}
This is another
article related to the window.h library function. Here I will take you through
resizing the console window and moving it on the screen at the desire position. Using window.h library function is the only option to control console windows if you are not using third-party graphics library. Resizing and moving console window function is useful if your application needs to create multiple windows and position it as per requirement.
Note: Below sample C code works only in the windows environment.
#include <windows.h>
#include <stdio.h>
HWND WINAPI GetConsoleWindowNT(void)
{
//declare function pointer type
typedef HWND WINAPI(*GetConsoleWindowT)(void);
//declare one such function pointer
GetConsoleWindowT GetConsoleWindow;
//get a handle on kernel32.dll
HMODULE hk32Lib = GetModuleHandle(TEXT("KERNEL32.DLL"));
//assign procedure address to function pointer
GetConsoleWindow = (GetConsoleWindowT)GetProcAddress(hk32Lib
,TEXT("GetConsoleWindow"));
//check if the function pointer is valid
//since the function is undocumented
if(GetConsoleWindow == NULL){
return NULL;
}
//call the undocumented function
return GetConsoleWindow();
}
int main()
{
HWND hWnd=GetConsoleWindowNT();
MoveWindow(hWnd,1230,600,300,200,TRUE);
}
I suggest you to test the parameters values of the function MoveWindow because the maximum value depends upon the size of the laptop or monitor screen.
In my earlier
article changing text color in codeblock
and text background color of console,
I had provided a sample source code to change text color and text background
color using windows.h library function. Similarly, we can also change console
windows background color using windows.h library function. Here, I have shared a sample source code to change the console windows background color. The sample
program is written in C.
#include <windows.h> //header file for windows
#include <stdio.h>
void ClearConsoleToColors(int ForgC, int BackC);
int main()
{
ClearConsoleToColors(0,1);
Sleep(1000);
return 0;
}
void ClearConsoleToColors(int ForgC, int BackC)
{
WORD wColor = ((BackC & 0x0F) << 4) + (ForgC & 0x0F);
//Get the handle to the current output buffer...
HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
//This is used to reset the carat/cursor to the top left.
COORD coord = {0, 0};
//A return value... indicating how many chars were written
// not used but we need to capture this since it will be
// written anyway (passing NULL causes an access violation).
DWORD count;
//This is a structure containing all of the console info
// it is used here to find the size of the console.
CONSOLE_SCREEN_BUFFER_INFO csbi;
//Here we will set the current color
SetConsoleTextAttribute(hStdOut, wColor);
if(GetConsoleScreenBufferInfo(hStdOut, &csbi))
{
//This fills the buffer with a given character (e.g 32=space).
FillConsoleOutputCharacter(hStdOut, (TCHAR) 32
, csbi.dwSize.X * csbi.dwSize.Y, coord, &count);
FillConsoleOutputAttribute(hStdOut, csbi.wAttributes
, csbi.dwSize.X * csbi.dwSize.Y, coord, &count );
//This will set our cursor position for the next print statement.
SetConsoleCursorPosition(hStdOut, coord);
}
return;
}
You can change
console windows background color by passing integer value range 0 up-to 256 in
ClearConsoleToColors(int ForgC, int BackC) function.
Usually, console applications are black and white. However, sometimes for specific purposes, we may need to change the text background color to highlight the specific texts. Changing text background color in the console is challenging especially if you are using Codeblocks MinGW. Unlike turbo c/c++ GCC does not provide the function to change the text background color. If you want to change the text background color then we should use windows.h library function. You can find the sample code below which change text background color. The sample program is written in C utilizing windows.h library function.
#include <windows.h> //header file for windows
#include <stdio.h> //C standard library
void SetBackgroundColor(int BackC);
int main(){
int i=0;
for(i=0; i<256; i++){
SetBackgroundColor(i);
printf("Test Text Background Color for value i: %d\n",i);
}
getch();
return 0;
}
void SetBackgroundColor(int BackC)
{
CONSOLE_SCREEN_BUFFER_INFO csbi;
WORD wColor = ((BackC & 0x0F) << 4) + (csbi.wAttributes & 0x0F);
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), wColor);
return;
}
In output program, for every 16 values (0-15, 16-32, etc) text colors will repeat. It means in this method we get only 4 bit color space i.e only 16 colors. You can change your desired text background color by passing integer value range 0 up to 15 in SetBackgroundColor() function.
Usually, console applications are black and white. However, sometimes for specific purposes, we need to change the text color to highlight the specific values, dates, or texts. Changing text color in the console is challenging especially if you are using Codeblocks MinGW. Unlike turbo c/c++ GCC does not provide the function to change text color. If you want to change the text color to make console windows colorful then we should use windows.h library function. You can find the sample code below which change text color. The sample program is written in C utilizing windows.h library function.
#include <windows.h> //header file for windows
#include <stdio.h> //C standard library
void SetColor(int ForgC);
int main(){
int i=0;
for(i=0; i<256; i++){
setColor(i);
printf("Test Color Text for value i: %d\n",i);
}
getch();
return 0;
}
void setColor(int ForgC){
//We will need this handle to get the current background attribute
WORD wColor;
HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
//we use csbi for the wAttributes word.
CONSOLE_SCREEN_BUFFER_INFO csbi;
if(GetConsoleScreenBufferInfo(hStdOut, &csbi)){
//Mask out all but the background attribute
//, and add in the foreground color
wColor = (csbi.wAttributes & 0xF0) + (ForgC & 0x0F);
SetConsoleTextAttribute(hStdOut, wColor);
}
return;
}
In output program, for every 16 values (0-15, 16-32, etc) text colors will repeat. It means in this method we get only 4 bit color space i.e only 16 colors. You can change your desired text color by passing integer value range 0 up to 15 in SetColor() function.
gotoxy(int x, int y) a function available in Turbo C/C++. It is not standard C. This function is
used to move the cursor on the screen to the desire location. The top left
corner of the monitor is 0,0 and the bottom right corner might be any number
based on the size of the screen. But today's standard C++ compiler such as Visual
Studio, GCC and clang do not provide gotoxy function. However, if you are
developing console applications without a third party graphic library then gotoxy
function is useful to manage text alignment on the screen.
If you need similar
implementation on a windows machine with GCC compiler then here is an example
source code.
#include <windows.h> // header file for gotoxy
#include <iostream> //header file for standard input output
COORD coord= {0,0}; // this is global variable
void gotoxy(int x,int y)
{
coord.X=x;
coord.Y=y;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),coord);
}
int main()
{
//calling these function
int x;
gotoxy(15,5);
std::cout<<"1. This is item number one.";
gotoxy(15,7);
std::cout<<"2. This is item number two.";
gotoxy(15,9);
std::cout<<"3. This is item number three.";
gotoxy(15,11);
std::cout<<"4. This is item number four.";
gotoxy(15,13);
std::cout<<"5. This is item number five.";
std::cin>>x;
return 0;
}
Please watch the video below for detailed explanation.
The project, “Library Management in C,” is larger and more complex than my other projects, such as the Quiz game, Contact Management, and Personal Diary Management. In this project, I have implemented a variety of techniques and features, including Admin and Student modes, user security, reading and writing CSV files, and many others. This project will provide you with numerous insights. If you’re aiming for the highest grade in your project/lab assignment, I recommend following this project.
The main objective of this project is to introduce you to the following techniques and features:
Breaking down the application and representing it with a flowchart
Creating a function call stack diagram
Creating an application menu and navigating in and out of the user screens
Implementing a user login system using a username and password
Reading and writing data from and into a CSV file
Dynamic memory allocation to create dynamic array
Add and delete data from dynamic memory array.
Performing CRUD (Create, Read, Update, and Delete) operations in C file handling
Implementing many utility functions such as converting an integer to a string, a string to an integer, hiding password by displaying asterisks
In this article, I will not explain each and every function of the application. The style of creating a user menu and the technique of switching in and out of the screens, C file handling is the same as in other projects. Here, I will explain the flowchart, function call stack diagram, and major functions such as the login system, reading and writing CSV files, and other major and complex functions.
You can download the final version of the application from Github Download from Github.
I have divided this project into 4 parts. Also, please follow YouTube video to get more details about the project.