76 387
Assignments Done
Successfully Done
In May 2019

Answer to Question #16572 in C++ for nardeen

Question #16572
1- Write a C++ program to define a class for Student; the class should have three 3 private member variables name of type char array size 10, age of type integer, and GPA of type float. Have two constructors (one default no arguments and one with three values one for each member variable) and a setter and getter for each member variable, one destructor. Make sure to validate your input values inside setters and getters by checking age to be above 0, and GPA above 0 and less than or equal to 100.
Declare an array of five students
Declare a function to read values of the objects array
Declare a function to print the name of the student who has the maximum GPA.
Expert's answer
#include <string>
#include <fstream>
#include <iostream>
using namespace std;

int main()
{ int i=-1,k,f=0,a;
while(i<0 || i%2==0)
cout<<"enter an odd positive integer: ";
for (a=0;a<i;a++){
& if(a!=(i-1)/2){
for (k=0;k<i;k++){
& if(k==f || k==(i-1-f))
& cout<<"0";
& else if (k==(i-1)/2)
& cout<<"-";
& else cout<<" ";
& }
cout<<"\n"; }
else {
for (k=0;k<i;k++){
& cout<<"\n";&


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!


No comments. Be first!

Leave a comment

Ask Your question

Privacy policy Terms and Conditions