Question: C++ program 1. What can I write for my code instead of setprecision (1)? string Subject::toString() { stringstream stream; // Formatting note with a digie

C++ program

1. What can I write for my code instead of "setprecision (1)"?

string Subject::toString() { stringstream stream; // Formatting note with a digie after point stream << fixed << setprecision(1) << grade; return description + ":" + stream.str(); }

2. Can I replace the for and if with another option?

void Student::sortByGrade() { // Verwenden der Auswahlsortierung, um die Fcher nach Klassen zu sortieren for (int i = 0; i < SUBJECT_ - 1; i++) { int index = -1; // Standardmaximalwert double lowGrade = 10.0; // Suche nach dem Miniumum-Element for (int j = i; j < SUBJECT_; j++) { if (subjects[i].getGrade() < lowGrade) { lowGrade = subjects[i].getGrade(); index = i; } } // tausche es bei Bedarf mit i'th aus if (index != i) { Subject sw = subjects[i]; subjects[i] = subjects[index]; subjects[index] = sw; } } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!