Answer to Question #283586 in C++ for Rameen

Question #283586

Director office requires applications from students for the award of scholarship, Each student required to submit reg no, name, semester and cgpa in the last semester. The form After placed one over the other initially the administration don't know how many student will apply reciving all the applications the administration check each application and formulate a list of students whose copa is more than 3.8. This list contains the student on top who applied first you are required to implement this senarioin C++ Assuming primitive functions are already availatle you have to add required functions only in the class main() function is also not required.


1
Expert's answer
2021-12-29T17:51:34-0500
#include<iostream>
#include<string>
#include<vector>

using namespace std;

struct Student
{
	int regNo;
	string name;
	int semestr;
	double cgpa;
	Student(){}
	Student(int _regNo,	string _name,int _semestr, double _cgpa)
	:regNo(_regNo), name(_name), semestr(_semestr), cgpa(_cgpa){}
};

class RecivingAward
{
	vector<Student>vs;
public:
	RecivingAward(){}
	void AddStudent(Student st)
	{
		vs.push_back(st);
	}
	void CheckStudents()
	{
		int regn;
		Student temp;
		do
		{
			cout << "Please, enter reg no of student (0 - exit): ";
			cin>> regn;
			if (regn == 0)break;
			temp.regNo = regn;
			cout << "Please, enter a name of student: ";
			cin >> temp.name;
			cout << "Please, enter a semestr: ";
			cin >> temp.semestr;
			cout << "Please, enter cgpa of student: ";
			cin >> temp.cgpa;
			if (temp.cgpa > 3.8)
				AddStudent(temp);
		} while (true);
	}


	void Display()
	{
		vector<Student>::iterator it;
		cout << "Awarded Students:";
		for (it = vs.begin(); it != vs.end(); ++it)
		{
			cout << "\nName:\t" << it->name;
			cout << "\nReg no:\t" << it->regNo;
			cout << "\nSemestr:\t" << it->semestr;
			cout << "\nCgpa:\t" << it->cgpa;
		}
	}
};

int main()
{
	RecivingAward rv;
	rv.CheckStudents();
	rv.Display();
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog