Student Management System In C++ With Source Code
The Student Management System In C++ is develop in C++ programming language, This Student Management System C++ is based on the concept to generate the Student’s Information records and to add & update it. Here User can add their Student’s detail with their courses safely and it’s not time-consuming.
A Student Management System In C++ Project makes easy to store records of each and every student. This program mainly focuses on CRUD with searching function.
This Student Management System C++ also includes a downloadable Student Management System C++ Source Code for free, just find the downloadable source code below and click to start downloading.
Watch the video here to see the full running Student management System in C++ with Source Code.
To start creating a Student Management System In C++,make sure that you have code blocks or any platform of C/C++ language installed in your computer.
Steps on how to create a Student Management System In C++
Student Management System In C++ With Source Code
- Step 1: Create a new project.
First open the code blocks IDE and click “create a new project“.
- Step 2: Choose console application.
Second click the “console application” and after that click “next“.
- Step 3: Choose C++ language.
Third choose “C++ language” and click “next“.
- Step 4: Name Your Project.
Fourth name the project you’ve created and click “next” after that click “finish“.
- Step 5: The actual code.
You are free to copy the given source code below or download the downloadable source code given.
The Code Given Below Is For The Log In Module
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
void login() { int a=0,i=0; char uname[10],c=' '; char pword[10],code[10]; char user[10]="user"; char pass[10]="pass"; do { printf("\n \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\ LOGIN FIRST \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\ "); printf(" \n\n ENTER USERNAME:="); scanf("%s", &uname); printf(" \n\n ENTER PASSWORD:="); while(i<10) { pword[i]=getch(); c=pword[i]; if(c==13) break; else printf("*"); i++; } pword[i]='\0'; //char code=pword; i=0; //scanf("%s",&pword); if(strcmp(uname,"user")==0 && strcmp(pword,"pass")==0) { printf(" \n\n\n WELCOME TO STUDENT MANAGEMENT SYSTEM !!!! LOGIN IS SUCCESSFUL"); printf("\n\n\n\t\t\t\tPress any key to continue..."); getch();//holds the screen break; } else { printf("\n SORRY !!!! LOGIN IS UNSUCESSFUL"); a++; getch();//holds the screen } } while(a<=2); if (a>2) { printf("\nSorry you have entered the wrong username and password for four times!!!"); getch(); } system("cls"); } |
In this module which is the login module of the system.
The Code Given Below Is For The Student Module
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 |
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 << "\n\t\t\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2 STUDENT MANAGEMENT SYSTEM \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2 "; cout << "\n\n\t\t ===========> www.itsourcecode.com <=========== "; cout <<"\n\n "; cout << "\n\n"; cout<<" \n\t\t\t\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2 "; cout << "\n \t\t\t Press 1> To Add Records"; cout << "\n \t\t\t Press 2> To View Records"; cout << "\n \t\t\t Press 3> To Modify Records"; cout << "\n \t\t\t Press 4> To Remove Records"; cout << "\n \t\t\t Press 5> To Exit Program"; cout<<" \n\t\t\t\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2 "; 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 First 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; cout << "Enter Home Address : "; fwrite(&e,recsize,1,fp); cout << "\n Add Another Record (Y/N) "; fflush(stdin); another = getchar(); } break; case '2': system("cls"); rewind(fp); cout << "\xB2\xB2 View the Records in the Database \xB2\xB2 "; cout << "\n"; while (fread(&e,recsize,1,fp) == 1){ cout << "\n"; cout <<"\nName :: " <<e.first_name <<" "<<e.last_name; //cout << "\n"; cout <<"\nCourse :: " <<e.course ; cout <<"\nSection :: "<<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 OUR SOFTWARE. :- IT SOURCECODE \n\n\t\t For more visit www.itsourcecode.com"; cout << "\n\n"; exit(0); } } |
In this module which is the student or the main module of the system.
Complete Source Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 |
#include <iostream> #include <cstdio> #include <cstring> #include <cstdlib> #include <conio.h> #include <iomanip> void login() { int a=0,i=0; char uname[10],c=' '; char pword[10],code[10]; char user[10]="user"; char pass[10]="pass"; do { printf("\n \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\ LOGIN FIRST \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\ "); printf(" \n\n ENTER USERNAME:="); scanf("%s", &uname); printf(" \n\n ENTER PASSWORD:="); while(i<10) { pword[i]=getch(); c=pword[i]; if(c==13) break; else printf("*"); i++; } pword[i]='\0'; //char code=pword; i=0; //scanf("%s",&pword); if(strcmp(uname,"user")==0 && strcmp(pword,"pass")==0) { printf(" \n\n\n WELCOME TO STUDENT MANAGEMENT SYSTEM !!!! LOGIN IS SUCCESSFUL"); printf("\n\n\n\t\t\t\tPress any key to continue..."); getch();//holds the screen break; } else { printf("\n SORRY !!!! LOGIN IS UNSUCESSFUL"); a++; getch();//holds the screen } } while(a<=2); if (a>2) { printf("\nSorry you have entered the wrong username and password for four times!!!"); getch(); } system("cls"); } using namespace std; int main() { login(); 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 << "\n\t\t\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2 STUDENT MANAGEMENT SYSTEM \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2 "; cout << "\n\n\t\t ===========> www.itsourcecode.com <=========== "; cout <<"\n\n "; cout << "\n\n"; cout<<" \n\t\t\t\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2 "; cout << "\n \t\t\t Press 1> To Add Records"; cout << "\n \t\t\t Press 2> To View Records"; cout << "\n \t\t\t Press 3> To Modify Records"; cout << "\n \t\t\t Press 4> To Remove Records"; cout << "\n \t\t\t Press 5> To Exit Program"; cout<<" \n\t\t\t\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2 "; 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 First 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; cout << "Enter Home Address : "; fwrite(&e,recsize,1,fp); cout << "\n Add Another Record (Y/N) "; fflush(stdin); another = getchar(); } break; case '2': system("cls"); rewind(fp); cout << "\xB2\xB2 View the Records in the Database \xB2\xB2 "; cout << "\n"; while (fread(&e,recsize,1,fp) == 1){ cout << "\n"; cout <<"\nName :: " <<e.first_name <<" "<<e.last_name; //cout << "\n"; cout <<"\nCourse :: " <<e.course ; cout <<"\nSection :: "<<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 OUR SOFTWARE. :- IT SOURCECODE \n\n\t\t For more visit www.itsourcecode.com"; cout << "\n\n"; exit(0); } } return 0; } |
Run Quick Virus Scan for secure Download
Run Quick Scan for safe DownloadDownloadable Source Code
Summary
The whole project is designed in ‘C++’ language and different variables and strings have been used for the development of this project. This mini project is easy to operate and understand by the users.
This simple project can enhance the knowledge of the beginners or the students to develop their skills in programming, also this project is easy to understand the module and their variables.
Related Articles
- School Management System In C++ With Source Code
- Bus Reservation System in C++ with Source Code
- Library Management System In C++ With Source Code
Inquiries
If you have any questions or suggestions about Student Management System In C++ With Source Code , please feel free to leave a comment below.