The students' success data is recorded in N lines of characters, each of which has the following structure: last name, etc., number of the record book, grades in five subjects. Data fields are separated by at least one character that is not used to write the specified data. Display the names of students whose average score is less than the specified value.

#include "stdafx.h" #include <string.h> #include <math.h> #include <iostream> using namespace std; int main() { char name[200], surname[200]; int number, mark[6]; int mmark; int k = 0; for (int i = 0; i < 6; i++) { cout << "Input Name, Surname, number and mark of " << i + 1 << " student: " << endl; cin >> name >> surname >> number >> mark[i]; cout << mark[0] << endl; } cout << "Input your medium mark: " << endl; cin >> mmark; cout << k << endl; return 0; } 

I do not know how to set estimates and find their arithmetic average. Tell me.!

Closed due to the fact that the question is too general for the participants αλεχολυτ , aleksandr barakin , HamSter , fori1ton , post_zeew Oct 22 '16 at 16:02 .

Please correct the question so that it describes the specific problem with sufficient detail to determine the appropriate answer. Do not ask a few questions at once. See “How to ask a good question?” For clarification. If the question can be reformulated according to the rules set out in the certificate , edit it .

  • one
    Looks like there is more than one question here. Try to make individual questions that can be specifically answered. - Timofei Bondarev

1 answer 1

Something like

 struct Student { string name, surname; int number, mark[5]; int sum() { return mark[0]+mark[1]+mark[2]+mark[3]+mark[4]; } }; int main() { vector<Student> studs; for (int i = 0; i < 6; i++) { Student s; cout << "Input Name, Surname, number and 5 mark of " << i + 1 << " student: " << endl; if (!(cin >> s.name >> s.surname >> s.number >> s.mark[0] >> s.mark[1] >> s.mark[2] >> s.mark[3] >> s.mark[4])) { cout << "Wrong input!\n"; cin.clear(); cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n'); --i; continue; } studs.push_back(s); } double nmark; cout << "Input your medium mark: " << endl; cin >> nmark; for(auto& s: studs) { if (s.sum() < 5*nmark) cout << s.name << " " << s.surname << endl; } return 0; }