Notes
Notes - notes.io |
#include <string>
#include<vector>
std::string addingstudentNumber;
struct student {
std::string sname;
std::string sid;
std::string ssurname;
double cgpa;
int grade;
};
student stdu1,stdu2,stdu3,stdu4,stdu5,stdu6,stdu7,stdu8,stdu9,stdu10;
void printClassList(std::vector<std::string> sclass,std::vector<int> sclassGrade,std::vector<std::string> sclassurname) {
for(int g=0; g<sclassGrade.size(); g++){
std::cout<<g+1<<"- "<<"Name: "<<sclass[g]<<"t";
std::cout<<"Surname: "<<sclassurname[g]<<"t";
std::cout<<"Grade: "<<sclassGrade[g]<<"n";
}
}
void addStudent(std::vector<std::string> sclass,std::vector<int> sclassGrade,std::vector<std::string> sclassurname,std::vector<std::string> sclassid,std::vector<double> sclassCgpa) {
std::string addingstudentName,addingstudentSurname;
int addingstudentGrade;
double addingstudentCGPA;
std::cout<<"Enter the name of a student: "; //name
std::cin>>addingstudentName;
stdu7.sname=addingstudentName;
sclass.push_back(stdu7.sname);
std::cout<<"Enter the surname of a student: "; //surname
std::cin>>addingstudentSurname;
stdu7.ssurname=addingstudentSurname;
sclass.push_back(stdu7.ssurname);
std::cout<<"Enter the number of a student: "; //number
std::cin>>addingstudentNumber;
stdu7.sid=addingstudentNumber;
sclassid.push_back(stdu7.sid);
std::cout<<"Enter the grade of a student: "; //grade
std::cin>>addingstudentGrade;
stdu7.grade=addingstudentGrade;
sclassGrade.push_back (stdu7.grade);
std::cout<<"Enter the CGPA of a student: "; //CGPA
std::cin>>addingstudentCGPA;
stdu7.cgpa = addingstudentCGPA;
sclassCgpa.push_back(stdu7.cgpa);
}
int main() {
int x;
std::vector<double> sclassCgpa;
std::vector<std::string> sclass;
std::vector<std::string> sclassid;
std::vector<std::string> sclassurname;
std::vector<int> sclassGrade;
//Student1
stdu1.sname="Dogukan";
stdu1.ssurname="GULYASAR";
stdu1.sid = "170992";
stdu1.cgpa = 3.07;
stdu1.grade = 100;
//Push
sclass.push_back (stdu1.sname);
sclassurname.push_back (stdu1.ssurname);
sclassCgpa.push_back(stdu1.cgpa);
sclassid.push_back(stdu1.sid);
sclassGrade.push_back (stdu1.grade);
//Student2
stdu2.sname="Kevin";
stdu2.ssurname="DURANT";
stdu2.sid = "160995";
stdu2.cgpa = 1.11;
stdu2.grade = 50;
//Push
sclass.push_back (stdu2.sname);
sclassurname.push_back (stdu2.ssurname);
sclassCgpa.push_back(stdu2.cgpa);
sclassid.push_back(stdu2.sid);
sclassGrade.push_back(stdu2.grade);
//Student3
stdu3.sname="John";
stdu3.ssurname="WICK";
stdu3.sid = "178564";
stdu3.cgpa = 2.97;
stdu3.grade = 78;
//Push
sclass.push_back (stdu3.sname);
sclassurname.push_back (stdu3.ssurname);
sclassCgpa.push_back(stdu3.cgpa);
sclassid.push_back(stdu3.sid);
sclassGrade.push_back(stdu3.grade);
//Student4
stdu4.sname="George";
stdu4.ssurname="ORWELL";
stdu4.sid = "125334";
stdu4.cgpa = 2.58;
stdu4.grade = 12;
//Push
sclass.push_back (stdu4.sname);
sclassurname.push_back (stdu4.ssurname);
sclassCgpa.push_back(stdu4.cgpa);
sclassid.push_back(stdu4.sid);
sclassGrade.push_back(stdu4.grade);
//Student5
stdu5.sname="Morgan";
stdu5.ssurname="FREEMAN";
stdu5.sid = "156429";
stdu5.cgpa = 4.00;
stdu5.grade = 95;
//Push
sclass.push_back (stdu5.sname);
sclassurname.push_back (stdu5.ssurname);
sclassCgpa.push_back(stdu5.cgpa);
sclassid.push_back(stdu5.sid);
sclassGrade.push_back(stdu5.grade);
//Student6
stdu6.sname="Mahmut";
stdu6.ssurname="ORHAN";
stdu6.sid = "142300";
stdu6.cgpa = 0.80;
stdu6.grade = 57;
//Push
sclass.push_back (stdu6.sname);
sclassurname.push_back (stdu6.ssurname);
sclassCgpa.push_back(stdu6.cgpa);
sclassid.push_back(stdu6.sid);
sclassGrade.push_back(stdu6.grade);
//Average Grade Calculating
int avGrade =0;
for(int c =0; c<sclassGrade.size(); c++) {
avGrade = sclassGrade[c] + avGrade;
}
avGrade = avGrade / sclassGrade.size();
//Average Finished
//For list
int p;
while(p!=1){
std::cout<<"Press the 1 to see class list: n";
std::cout<<"Press the 2 to add a student to class: n";
std::cin>>p;
switch(p) {
case 1:
printClassList(sclass,sclassGrade,sclassurname);
std::cout<<"Average Grade: "<<avGrade<<"n";
break;
case 2:
addStudent(sclass,sclassGrade,sclassurname,sclassid,sclassCgpa);
break;
}
}
std::cout<<"nPress the student list number:";
std::cin>>x;
switch(x) {
case 1:
std::cout<<"Name: "<<stdu1.sname<<"t "<<"ID: "<<stdu1.sid<<" t"<<"CGPA: "<<stdu1.cgpa<< "t"<<"Grade: "<<stdu1.grade;
if(stdu1.grade<avGrade){
std::cout<<"nDanger!! This student is under average!"<<"tAverage is: "<<avGrade;
}else if(stdu1.grade==avGrade){
std::cout<<"nThis student is absoluetly on the average."<<"tAverage is: "<<avGrade;
}else {
std::cout<<"nGreat! This student's grade is greater than class!"<<"tAverage is: "<<avGrade;
}
break;
case 2:
std::cout<<"Name: "<<stdu2.sname<<"t "<<"ID: "<<stdu2.sid<<" t"<<"CGPA: "<<stdu2.cgpa<< "t"<<"Grade: "<<stdu2.grade;
if(stdu2.grade<avGrade){
std::cout<<"nDanger!! This student is under average!"<<"tAverage is: "<<avGrade;
}else if(stdu2.grade==avGrade){
std::cout<<"nThis student is absoluetly on the average."<<"tAverage is: "<<avGrade;
}else {
std::cout<<"nGreat! This student's grade is greater than class!"<<"tAverage is: "<<avGrade;
}
break;
case 3:
std::cout<<"Name: "<<stdu3.sname<<"t "<<"ID: "<<stdu3.sid<<" t"<<"CGPA: "<<stdu3.cgpa<< "t"<<"Grade: "<<stdu3.grade;
if(stdu3.grade<avGrade){
std::cout<<"nDanger!! This student is under average!"<<"tAverage is: "<<avGrade;
}else if(stdu3.grade==avGrade){
std::cout<<"nThis student is absoluetly on the average."<<"tAverage is: "<<avGrade;
}else {
std::cout<<"nGreat! This student's grade is greater than class!"<<"tAverage is: "<<avGrade;
}
break;
case 4:
std::cout<<"Name: "<<stdu4.sname<<"t "<<"ID: "<<stdu4.sid<<" t"<<"CGPA: "<<stdu4.cgpa<< "t"<<"Grade: "<<stdu4.grade;
if(stdu4.grade<avGrade){
std::cout<<"nDanger!! This student is under average!"<<"tAverage is: "<<avGrade;
}else if(stdu4.grade==avGrade){
std::cout<<"nThis student is absoluetly on the average."<<"tAverage is: "<<avGrade;
}else {
std::cout<<"nGreat! This student's grade is greater than class!"<<"tAverage is: "<<avGrade;
}
break;
case 5:
std::cout<<"Name: "<<stdu5.sname<<"t "<<"ID: "<<stdu5.sid<<" t"<<"CGPA: "<<stdu5.cgpa<< "t"<<"Grade: "<<stdu5.grade;
if(stdu5.grade<avGrade){
std::cout<<"nDanger!! This student is under average!"<<"tAverage is: "<<avGrade;
}else if(stdu5.grade==avGrade){
std::cout<<"nThis student is absoluetly on the average."<<"tAverage is: "<<avGrade;
}else {
std::cout<<"nGreat! This student's grade is greater than class!"<<"tAverage is: "<<avGrade;
}
break;
case 6:
std::cout<<"Name: "<<stdu6.sname<<"t "<<"ID: "<<stdu6.sid<<" t"<<"CGPA: "<<stdu6.cgpa<< "t"<<"Grade: "<<stdu6.grade;
if(stdu6.grade<avGrade){
std::cout<<"nDanger!! This student is under average!"<<"tAverage is: "<<avGrade;
}else if(stdu6.grade==avGrade){
std::cout<<"nThis student is absoluetly on the average."<<"tAverage is: "<<avGrade;
}else {
std::cout<<"nGreat! This student's grade is greater than class!"<<"tAverage is: "<<avGrade;
}
break;
case 7:
std::cout<<"Name: "<<stdu7.sname<<"t "<<"ID: "<<stdu7.sid<<" t"<<"CGPA: "<<stdu7.cgpa<< "t"<<"Grade: "<<stdu7.grade;
if(stdu7.grade<avGrade){
std::cout<<"nDanger!! This student is under average!"<<"tAverage is: "<<avGrade;
}else if(stdu7.grade==avGrade){
std::cout<<"nThis student is absoluetly on the average."<<"tAverage is: "<<avGrade;
}else {
std::cout<<"nGreat! This student's grade is greater than class!"<<"tAverage is: "<<avGrade;
}
break;
}
}
|
Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 12 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team