-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
59 lines (41 loc) · 1.42 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#include <iostream>
#include <vector>
#include <list>
#include <iomanip>
#include <algorithm>
#include "student.h"
#include "helper.h"
#include "generator.h"
using std::cin;
using std::cout;
int main()
{
/*int m;
cout << "Kiek studentu sugeneruoti?";
cin >> m;
writeStudents(m);*/
std::list<Student> students = readFile();
sortStudents(students);
/*int n;
Student student;
cout << "Iveskite varda ir pavarde: ";
cin >> student.name >> student.surname;
cout << "Iveskite egzamino pazymi: ";
cin >> student.exam;
cout << "Iveskite pazymius: \n";
while (cin >> n)
student.marks.push_back(n);
students.push_back(student);
std::sort(students.begin(), students.end(), compareString);
cout << std::setw(15) << "Pavarde" << std::setw(15) << "Vardas" << std::setw(20) << "Galutinis (Vid.)" << std::setw(20) << "Galutinis (Med.)" << std::endl;
cout << std::setfill('-') << std::setw(80) << "-" << std::setfill(' ') << std::endl;
for (auto &s : students)
{
int sum_of_marks{};
for (auto &i : s.marks)
sum_of_marks += i;
s.final_mark_avg = 0.4 * (sum_of_marks / s.marks.size()) + 0.6 * s.exam;
s.final_mark_med = 0.4 * median(s.marks) + 0.6 * s.exam;
cout << std::setw(15) << s.surname << std::setw(15) << s.name << std::setw(15) << s.final_mark_avg << std::setw(15) << s.final_mark_med << std::endl;
}*/
}