This is simple student information system project.Wher you can do following things 1. Add Records
2. List Records
3. Modify Records
4. Delete Records
5. Exit Program
to store data file is used. Download project from GitHub.
Here is the source code,compile it in code::blocks
2. List Records
3. Modify Records
4. Delete Records
5. Exit Program
to store data file is used. Download project from GitHub.
Here is the source code,compile it in code::blocks
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <conio.h>
#include <iomanip>
using namespace std;
int main() {
FILE *fp, *ft;
char another, choice;
struct student {
char first_name[50], last_name[50];
char course[100];
int section;
};
struct student e;
char xfirst_name[50], xlast_name[50];
long int recsize;
fp=fopen("users.txt","rb+");
if (fp == NULL) {
fp = fopen("users.txt","wb+");
if (fp==NULL)
{
puts("Cannot open file");
return 0;
}
}
recsize = sizeof(e);
while(1) {
system("cls");
cout << "\t\t====== STUDENT INFORMATION SYSTEM ======";
cout <<"\n\n ";
cout << "\n\n";
cout << "\n \t\t\t 1. Add Records";
cout << "\n \t\t\t 2. List Records";
cout << "\n \t\t\t 3. Modify Records";
cout << "\n \t\t\t 4. Delete Records";
cout << "\n \t\t\t 5. Exit Program";
cout << "\n\n";
cout << "\t\t\t Select Your Choice :=> ";
fflush(stdin);
choice = getche();
switch(choice)
{
case '1' :
fseek(fp,0,SEEK_END);
another ='Y';
while(another == 'Y' || another == 'y')
{
system("cls");
cout << "Enter the Firt Name : ";
cin >> e.first_name;
cout << "Enter the Last Name : ";
cin >> e.last_name;
cout << "Enter the Course : ";
cin >> e.course;
cout << "Enter the Section : ";
cin >> e.section;
fwrite(&e,recsize,1,fp);
cout << "\n Add Another Record (Y/N) ";
fflush(stdin);
another = getchar();
}
break;
case '2':
system("cls");
rewind(fp);
cout << "=== View the Records in the Database ===";
cout << "\n";
while (fread(&e,recsize,1,fp) == 1){
cout << "\n";
cout <<"\n" << e.first_name << setw(10) << e.last_name;
cout << "\n";
cout <<"\n" <<e.course << setw(8) << e.section;
}
cout << "\n\n";
system("pause");
break;
case '3' :
system("cls");
another = 'Y';
while (another == 'Y'|| another == 'y')
{
cout << "\n Enter the last name of the student : ";
cin >> xlast_name;
rewind(fp);
while (fread(&e,recsize,1,fp) == 1)
{
if (strcmp(e.last_name,xlast_name) == 0)
{
cout << "Enter new the Firt Name : ";
cin >> e.first_name;
cout << "Enter new the Last Name : ";
cin >> e.last_name;
cout << "Enter new the Course : ";
cin >> e.course;
cout << "Enter new the Section : ";
cin >> e.section;
fseek(fp, - recsize, SEEK_CUR);
fwrite(&e,recsize,1,fp);
break;
}
else
cout<<"record not found";
}
cout << "\n Modify Another Record (Y/N) ";
fflush(stdin);
another = getchar();
}
break;
case '4':
system("cls");
another = 'Y';
while (another == 'Y'|| another == 'y')
{
cout << "\n Enter the last name of the student to delete : ";
cin >> xlast_name;
ft = fopen("temp.dat", "wb");
rewind(fp);
while (fread (&e, recsize,1,fp) == 1)
if (strcmp(e.last_name,xlast_name) != 0)
{
fwrite(&e,recsize,1,ft);
}
fclose(fp);
fclose(ft);
remove("users.txt");
rename("temp.dat","users.txt");
fp=fopen("users.txt","rb+");
cout << "\n Delete Another Record (Y/N) ";
fflush(stdin);
another = getchar();
}
break;
case '5':
fclose(fp);
cout << "\n\n";
cout << "\t\t THANK YOU FOR USING THIS SOFTWARE";
cout << "\n\n";
exit(0);
}
}
system("pause");
return 0;
}
i want a c project on faculty feedback system
ReplyDeletethis program have 14 errors and 1 warning ... i am unable to run this program
ReplyDeletehey i need u i have some qu for you
DeleteAll the program of c and c++ is compile in gcc compiler and codeblocks IDE. so , if you compile this program in turbo c then you will get error
ReplyDeleteif i compile it in visual studio 2010 it shows me 8 errors .... how do i overcome it ??
ReplyDeleteis this gcc compiler is diffrent copiler??
ReplyDeletecould anyone give me the link to download gcc
DeleteHow you compile I don't Know? There is 6 warning but no error. You can download the project file with source code compile in visual studio 2010 for this link https://www.dropbox.com/sh/6iurx6sgps4oloc/vf--GyGi7x/studentDatabase.rar
ReplyDeletehey bro. Cool code. Compiled it with g++ in geany. It gives this error:
ReplyDeletestudent.cpp:23: warning: unused variable 'xfirst_name'
...and sure enough you declared it but never used it. What's it for?
sry it not error but warning :P
ReplyDeleteThank you for posting this. It worked for me. No errors. I used dev c/c++
ReplyDeleteOnce more thanks :)
error :Declaration syntax error at line no 8.please give me solution for it.
ReplyDeletepls i need the flowchart for this program
ReplyDeleteI wanna this project like class and use get and set ......how can help me ???
ReplyDeleteI wanna today or tomorrow
Deleteit gives the following error in visual studio 2012:
ReplyDeleteError 1 error C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. c:\users\sheikh noman mehmood\documents\visual studio 2012\projects\consoleapplication1\consoleapplication1\consoleapplication1.cpp 27
i want coding for timetable management system.....
ReplyDeletecan u get me the code for this title(Time table Mgmt System).
Deleteguys plz mention output :( no o/p no marks
ReplyDeleteur idiotic project has 24 errors
ReplyDeleteis the personal information mangement and employ mangement system same thing?
ReplyDeleteplz tell me...
Awsome Bro cool project!!
ReplyDeletewhy is it showing the all questions when you want to Add another record ?
ReplyDeleteHey,that's really cool!But there's an error.When I want to delete a record,it displays the "Last Name" text and "Continue "text together.I think you need to fix it.
ReplyDeleteMaster of Computer Application is a post graduation degree with 3 years of duration. There are many top colleges that provide MCA course. One need to clear the entrance exam for the admission in to this course.
ReplyDeleteTop MCA Colleges India Thanks for sharing.
Do you have the file "users.txt" to open and manipulate with this source code? I'm not sure how to make this text file correctly on my own so it could be used in the code properly.
ReplyDeletei want c++ project on feed back mangement system in which parents give feedback and the computer will tell the summary of their feedback that the school is good the school is clean e.t.c
ReplyDeletegood program
ReplyDeleteWell done
ReplyDeleteIt gives error at 8 line declaration syntax error
ReplyDeleteNo classes. The only C++ here is cout and cin. The rest is C. Not even C++ styles (//) comments.
ReplyDeletevery good , thanks sir....
ReplyDeleteAny 1 plz give me text file
ReplyDeleteGood, but can't search
ReplyDeletethank's
ReplyDeleteThere is no Error neither the Warning.
ReplyDeletebut there is a bug
that is , if we insert course name in more than a word like "Information technology"
than it keeps on repeating this second word in all next required informations.
Otherwise the code is Good.
If you use "cout" this doesn't mean C++.
ReplyDeleteC++ is object oriented. What you have write is C and same elements of C++.
Do u have "Hospital Registration and Database" dev C++? or can you help creating it? :) Thanks for this awesome codes.
ReplyDeletehow to delete student info using roll number? deleting from last name is complicated
ReplyDeletebecause if many person have same last name then all the data are deleted plz help to fix this :) waiting for your positive response
Great!! No Errors! Nice Project
ReplyDeletecan someone explain the codes one by one please? :(
ReplyDelete