One of the most common business applications that is widely used is Student Grading System that is being used to compute and store information about the student school academic performance. In this article I would like to share with you a simple student grading system application that I wrote using C++ programming language.
In this application I am using structure as my data structure in storing different records of the students in an array. Using structure it enables us to store and retrieve different values from our array, in this program I have five variables that is being store in our structure name student records. This variables are follows
string first_name[5]; string last_name[5]; int age[5]; string major_course[5]; and float gpa_grade[5];.
Our program will accept five names of the students from the user using one dimensional array we will store those different variable entries in our array and then populate all the records afterwards in our program. This program is simple enough to give you some idea how to understand the proper way how to use one dimensional array and structure in accepting and manipulating records. In writing this program I am using Code Blocks as my text editor and Dev C++ as my C++ compiler.
In hope you will find my work useful in programming assignments and projects in C++.
Sample Output of Our Program
Program Listing
#include <iostream>
#include <iomanip>
#include <stdlib.h>
using namespace std;
struct student_records{
string first_name[5];
string last_name[5];
int age[5];
string major_course[5];
float gpa_grade[5];
};
main() {
student_records student;
cout << "\t =========================================\n";
cout << "\t ===== Student Grading Record System =====\n";
cout << "\t =========================================\n";
for (int x=0; x<5; x+=1) {
cin.ignore();
cout << "\n\n";
cout << "Enter student no." <<x+1 << " First name :";
getline(cin,student.first_name[x]);
cout << "Enter student no." <<x+1 << " Last name :";
getline(cin,student.last_name[x]);
cout << "Enter student no." <<x+1 << " Age : ";
cin >> student.age[x];
cin.ignore();
cout << "Enter student no." <<x+1 << " Majoring : ";
getline(cin,student.major_course[x]);
cout << "Enter student no." <<x+1 << " GPA : ";
cin >> student.gpa_grade[x];
}
cout << "\n\n";
for (int y=0; y<5; y+=1) {
cout << "\n\n";
cout << "Record No. " << y+1;
cout << "\n First Name : " << student.first_name[y];
cout << "\n Last Name : " << student.last_name[y];
cout << "\n Age : " << student.age[y];
cout << "\n Majoring : " << student.major_course[y];
setprecision(2);
cout << "\n GPA : " << student.gpa_grade[y];
cout << "\n\n";
}
system("pause");
}