A simple database using arrays in C++ I called this program Student's Information System Using Arrays in C++.
programming projects , thesis and capstone projects, IT consulting
work, computer tutorials and web development work kindly contact me in the following email address for further details. If you want to advertise in my website kindly contact me also in my email address also. Thank you.
student.cpp
/*
Program name : Student's Information System Using Array
Author : Jake Rodriguez Pomperada, BSCS, MAED-IT
Description : A simple C++ program that enables the user to enter,
search, and display student records using Array.
Language C++
Date : August 7, 2018 Tuesday
Location : Bacolod City, Negros Occidental Philippines.
*/
#include <iostream>
#include <string>
#include <conio.h>
using namespace std;
// The starting point of program execution
int main()
{
string fname[256], lname[256], address[256];
double pg[256], mg[256], eg[256], fg[256];
int search=0;
int stud_id[200];
int choice=0;
do
{
system("cls");
/*
display menu at program startup
*/
cout << "\n\n";
cout << "\t Welcome !!! ";
cout << "\n\n";
cout<<"\t ****** Student's Information System Using Array *********" <<"\n";
cout<<"\t * [1] Enter new student record(s) *" <<"\n";
cout<<"\t * [2] Display all student record(s) *" <<"\n";
cout<<"\t * [3] Search student record *" <<"\n";
cout<<"\t * [4] About this Program *" <<"\n";
cout<<"\t * [5] Quit Program *" <<"\n";
cout<<"\t *********************************************************" ;
cout <<"\n\n";
cout<<"\t Select Your Choice : ";
cin>>choice;
switch(choice)
{
/*
1st choice is where the user
enters student's details
*/
case 1:
system("cls");
int num_rec;
cout<<"** Number of records to be entered **";
cout <<"\n";
cout<<"Number : ";
cin>>num_rec;
cin.ignore();
for (int a=0; a<num_rec; a++)
{
system("cls");
cout<<"Total number of records to be entered "<<num_rec << " : ";
cout <<"\n";
cout<<"Record number : "<<a+1 <<" : ";
cout <<"\n";
cin.ignore();
cout <<"Student ID : ";
cin >> stud_id[a];
cin.ignore();
cout<<"First name : ";
getline (cin,fname[a]);
cout <<"\n";
cout<<"Last name : ";
getline (cin,lname[a]);
cout <<"\n";
cout<<"Address : ";
getline (cin,address[a]);
cout <<"\n";
cout<<"Student Grading Information";
cout << "\n\n";
cout<<"Prelim Grade : ";
cin>>pg[a];
cout <<"\n";
cout<<"Midterm Grade : ";
cin>>mg[a];
cout <<"\n";
cout<<"Endterm Grade : ";
cin>>eg[a];
fg[a] = (pg[a]*.3+mg[a]*.3+eg[a]*.4);
}
cout <<"\n";
cout<<"Press any key to return to main menu";
getch();
break;
case 2:
/*
2nd choice displays the number
and the list of records found in the system
*/
cout<<"** Number of records currently found in the system **" <<"\n";
cout <<"\n";
cout<<"# "<<num_rec <<"\n";
cout<<"Press any key to view the records "<<"\n";
getch();
system("cls");
for (int a=0; a<num_rec; a++)
{
cout <<"\n";
cout<<"Record number : "<<a+1;
cout <<"\n";
cout << "Student ID No. : " << stud_id[a];
cout <<"\n";
cout<<"Student's name : ";
cout <<"\n";
cout<<lname[a]<<" , "<<fname[a];
cout <<"\n";
cout<<"Adress :";
cout<<address[a];
cout <<"\n\n";
cout<<"Final grade : " <<" "<<fg[a];
cout <<"\n";
cout<<"--------------------------------------------";
}
cout <<"\n";
cout<<"Press any key to return to main menu";
getch();
break;
case 3:
/*
3rd choice enables the user to search
for the last name of the student
found in the system
*/
system("cls");
cout<<"** Search and display student's details **"<<"\n";
cout <<"\n";
cout<<"Type student's ID : ";
cin>>search;
cin.ignore();
for (int a=0; a<=num_rec; a++)
{
if (search==stud_id[a])
{
cout <<"\n";
cout << "Student ID No. " << stud_id[a];
cout << "\n\n";
cout<<"Student's name ";
cout<<lname[a]<<", "<<fname[a]<<"\n";
cout <<"\n";
cout<<"Adress "<<" ";
cout<<address[a];
cout <<"\n";
cout<<"Final grade "<<"" <<fg[a];
cout <<"\n\n";
break;
}
else
{
cout <<"\n\n";
cout<<"** Record not found Try again **"<<"\n";
break;
}
}
cout <<"\n";
cout<<"Press any key to return to main menu"<<"\n";
getch();
break;
case 4:
/*
4th and last choice
is About the Program
*/
system("cls");
cout<<"Progam name : Student's Information System Using Array"<<"\n";
cout<<"Author : Mr. Jake Rodriguez Pomperada, BSCS, MAED-IT"<<"\n";
cout<<"Description : A simple C++ program that enables the user to enter, search, and display student details."<<"\n";
cout<<"Date : August 7, 2018 Tuesday ";
cout <<"\n\n";
cout<<"Press any key to return to main menu"<<"\n";
getch();
break;
}
}
while(choice!=5);
return 0;
} // End of Program
I am currently accepting programming work, it project, school
programming projects , thesis and capstone projects, IT consulting
work, computer tutorials and web development work kindly contact me in the following email address for further details. If you want to advertise in my website kindly contact me also in my email address also. Thank you.
My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.
My mobile number here in the Philippines is 09173084360.
My telephone number at home here in Bacolod City, Negros Occidental Philippines is +63 (034) 4335675.
Sample Program Output
/*
Program name : Student's Information System Using Array
Author : Jake Rodriguez Pomperada, BSCS, MAED-IT
Description : A simple C++ program that enables the user to enter,
search, and display student records using Array.
Language C++
Date : August 7, 2018 Tuesday
Location : Bacolod City, Negros Occidental Philippines.
*/
#include <iostream>
#include <string>
#include <conio.h>
using namespace std;
// The starting point of program execution
int main()
{
string fname[256], lname[256], address[256];
double pg[256], mg[256], eg[256], fg[256];
int search=0;
int stud_id[200];
int choice=0;
do
{
system("cls");
/*
display menu at program startup
*/
cout << "\n\n";
cout << "\t Welcome !!! ";
cout << "\n\n";
cout<<"\t ****** Student's Information System Using Array *********" <<"\n";
cout<<"\t * [1] Enter new student record(s) *" <<"\n";
cout<<"\t * [2] Display all student record(s) *" <<"\n";
cout<<"\t * [3] Search student record *" <<"\n";
cout<<"\t * [4] About this Program *" <<"\n";
cout<<"\t * [5] Quit Program *" <<"\n";
cout<<"\t *********************************************************" ;
cout <<"\n\n";
cout<<"\t Select Your Choice : ";
cin>>choice;
switch(choice)
{
/*
1st choice is where the user
enters student's details
*/
case 1:
system("cls");
int num_rec;
cout<<"** Number of records to be entered **";
cout <<"\n";
cout<<"Number : ";
cin>>num_rec;
cin.ignore();
for (int a=0; a<num_rec; a++)
{
system("cls");
cout<<"Total number of records to be entered "<<num_rec << " : ";
cout <<"\n";
cout<<"Record number : "<<a+1 <<" : ";
cout <<"\n";
cin.ignore();
cout <<"Student ID : ";
cin >> stud_id[a];
cin.ignore();
cout<<"First name : ";
getline (cin,fname[a]);
cout <<"\n";
cout<<"Last name : ";
getline (cin,lname[a]);
cout <<"\n";
cout<<"Address : ";
getline (cin,address[a]);
cout <<"\n";
cout<<"Student Grading Information";
cout << "\n\n";
cout<<"Prelim Grade : ";
cin>>pg[a];
cout <<"\n";
cout<<"Midterm Grade : ";
cin>>mg[a];
cout <<"\n";
cout<<"Endterm Grade : ";
cin>>eg[a];
fg[a] = (pg[a]*.3+mg[a]*.3+eg[a]*.4);
}
cout <<"\n";
cout<<"Press any key to return to main menu";
getch();
break;
case 2:
/*
2nd choice displays the number
and the list of records found in the system
*/
cout<<"** Number of records currently found in the system **" <<"\n";
cout <<"\n";
cout<<"# "<<num_rec <<"\n";
cout<<"Press any key to view the records "<<"\n";
getch();
system("cls");
for (int a=0; a<num_rec; a++)
{
cout <<"\n";
cout<<"Record number : "<<a+1;
cout <<"\n";
cout << "Student ID No. : " << stud_id[a];
cout <<"\n";
cout<<"Student's name : ";
cout <<"\n";
cout<<lname[a]<<" , "<<fname[a];
cout <<"\n";
cout<<"Adress :";
cout<<address[a];
cout <<"\n\n";
cout<<"Final grade : " <<" "<<fg[a];
cout <<"\n";
cout<<"--------------------------------------------";
}
cout <<"\n";
cout<<"Press any key to return to main menu";
getch();
break;
case 3:
/*
3rd choice enables the user to search
for the last name of the student
found in the system
*/
system("cls");
cout<<"** Search and display student's details **"<<"\n";
cout <<"\n";
cout<<"Type student's ID : ";
cin>>search;
cin.ignore();
for (int a=0; a<=num_rec; a++)
{
if (search==stud_id[a])
{
cout <<"\n";
cout << "Student ID No. " << stud_id[a];
cout << "\n\n";
cout<<"Student's name ";
cout<<lname[a]<<", "<<fname[a]<<"\n";
cout <<"\n";
cout<<"Adress "<<" ";
cout<<address[a];
cout <<"\n";
cout<<"Final grade "<<"" <<fg[a];
cout <<"\n\n";
break;
}
else
{
cout <<"\n\n";
cout<<"** Record not found Try again **"<<"\n";
break;
}
}
cout <<"\n";
cout<<"Press any key to return to main menu"<<"\n";
getch();
break;
case 4:
/*
4th and last choice
is About the Program
*/
system("cls");
cout<<"Progam name : Student's Information System Using Array"<<"\n";
cout<<"Author : Mr. Jake Rodriguez Pomperada, BSCS, MAED-IT"<<"\n";
cout<<"Description : A simple C++ program that enables the user to enter, search, and display student details."<<"\n";
cout<<"Date : August 7, 2018 Tuesday ";
cout <<"\n\n";
cout<<"Press any key to return to main menu"<<"\n";
getch();
break;
}
}
while(choice!=5);
return 0;
} // End of Program
No comments:
Post a Comment