I cant print the name with the highest average | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I cant print the name with the highest average

Write an OOP program in C++ for the student class that contain the following data members (ID, name, age, address, deg1, deg2, deg3, deg4, deg5, deg6, deg7) , define five students print their averages, then print the name of the student with the highest average ? https://code.sololearn.com/c1JmE0enijYm/?ref=app https://code.sololearn.com/c1JmE0enijYm/?ref=app

9th Nov 2018, 9:20 AM
Gazwan Nagm
5 Answers
+ 6
Sure, I didn't saw cins in there. Here I used a pointer to class information, so you can print data of choosen student without many if statements. I added function 'getName' too, beacuse 'string name' is private and you cannot use it outside the class. I hope it's what you wanted. https://code.sololearn.com/cwD1ZFWAY03e/?ref=app
10th Nov 2018, 8:07 AM
Aleksander Szczepura
Aleksander Szczepura - avatar
+ 4
You didn't entered the values of degrees, you should assing default values in constructor.
9th Nov 2018, 9:42 PM
Aleksander Szczepura
Aleksander Szczepura - avatar
+ 1
Thank you...
10th Nov 2018, 4:18 PM
Gazwan Nagm
+ 1
صوج الله
25th Feb 2019, 6:26 PM
Gazwan Nagm
0
No i used the cin direction And why should i make it default
10th Nov 2018, 5:26 AM
Gazwan Nagm