Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- #include <vector>
- using namespace std;
- struct studentas{
- string firstName[100];
- string secondName[100];
- vector<double> nd;
- vector <double>egz;
- };
- int main()
- {
- //Storing information
- cout << "Kiek noresite ivesti studentu ?"<< endl;
- int stud;
- cin >> stud;
- /*
- while (stud =< 0 || stud == " ")
- {
- cout << "Ivedet neteisingus duomenis, prasome vesti per nauja: "<< endl;
- cin >> stud
- }
- */
- cout << "Kiek noresite ivesti namu darbu ?"<< endl;
- int n;
- cin >> n;
- vector<double> ndVid(n);
- //double ndMed[n];
- vector<double> galutinis(stud);
- studentas s;
- s.nd.resize(100);
- s.egz.resize(100);
- cout << "Iveskit studentu informacija: " << endl;
- for (int i = 0; i < stud; i++)
- {
- ndVid[i] = 0;
- cout << "Iveskit varda: ";
- cin >> s.firstName[i];
- cout << "Iveskit pavarde: ";
- cin >> s.secondName[i];
- cout << "Iveskit egzamino rezultata: ";
- cin >> s.egz[i];
- //Vidurkio skaiciavimas
- for (int j = 0; j< n; j++){
- cout << "Iveskit namu darbo rezultata: ";
- cin >> s.nd[j];
- cout << s.nd[j];
- ndVid[i] += s.nd[j];
- }
- ndVid[i] /= n;
- galutinis[i] = 0.4 * ndVid[i] + 0.6 * s.egz[i];
- }
- //Displaying information
- cout << "Jusu pateikta informacija: " << endl;
- cout << "Pavarde" << " " << "Vardas" <<" "<< "Galutinis(Vid.)" << endl;
- for (int i = 0; i < 20; i++ ){
- cout <<"-";
- }
- cout<<endl;
- for (int i = 0; i <stud; ++i)
- {
- cout << s.firstName[i] << " " << s.secondName[i] << fixed<< setprecision(2) <<" "<< galutinis[i] << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement