Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <string>
- #include <queue>
- #include <algorithm>
- #include <iomanip>
- using namespace std;
- ifstream in("input.txt");
- ofstream out("output.txt");
- struct Student
- {
- int n, age;
- string name, surname, secondname, gender;
- int ses[5];
- void print();
- };
- void Student::print()
- {
- out << setw(12) << left << surname << setw(10) << name << setw(15) << secondname << setw(6) << gender << setw(2) << age;
- for (int i = 0; i < 5; i++)
- out << setw(3) << ses[i];
- }
- int main()
- {
- int n = 0, m;
- Student students[3];
- queue<int>q1;
- if (!in)
- cout << "Error,file doesn't open";
- else
- {
- in >> m;
- while (in.peek() != EOF)
- {
- in >> students[n].surname;
- in >> students[n].name;
- in >> students[n].secondname;
- in >> students[n].gender;
- in >> students[n].age;
- for (int j = 0; j < 5; j++)
- {
- in >> students[n].ses[j];
- q1.push(students[n].ses[j]);
- }
- n++;
- }
- for (int i = 0; i < n; i++){
- int sum = q1.front() + 0;
- q1.pop();
- if (sum >= 16)
- {
- students[i].print();
- }
- }
- }
- in.close();
- out.close();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment