Advertisement
PomozMi

Untitled

Mar 10th, 2015
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.64 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <string>
  4. #include <algorithm>
  5. #include <vector>
  6.  
  7. using namespace std;
  8.  
  9. class Student
  10. {
  11. public:
  12.     Student();
  13.     void wypisz(){
  14.         cout << "Imie:" << imie;
  15.         cout << "Nazwisko" << nazwisko << endl;
  16.         cout << "Numer indeksu" << numer_indeksu << endl;
  17.         cout << "Numer_zarejestrowanej_pracy_dyplomowej" << numer_zarejestrowanej_pracy_dyplomowej << endl;
  18.         cout << "Srednia ze studiow" << srednia_ze_studiow << endl;
  19.     }
  20.  
  21.     void wpisz(string i, string n, int n1, int n2, float s){
  22.         imie = i;
  23.         nazwisko = n;
  24.         numer_indeksu = n1;
  25.         numer_zarejestrowanej_pracy_dyplomowej = n2;
  26.         srednia_ze_studiow = s;
  27.     }
  28. private:
  29.     string imie, nazwisko;
  30.     int numer_indeksu, numer_zarejestrowanej_pracy_dyplomowej;
  31.     float srednia_ze_studiow;
  32. };
  33.  
  34. void zad7(){
  35.  
  36.         cout << "Odczytywanie pliku..." << endl;
  37.         int n;
  38.         cout << "Podaj n :";
  39.         cin >> n;
  40.         string imie, nazwisko;
  41.         int numer_indeksu, numer_zarejestrowanej_pracy_dyplomowej;
  42.         float srednia_ze_studiow;
  43.         std::vector<Student*> studenty;
  44.  
  45.         for (int i = 0; i < n; i++)
  46.         {
  47.             Student *student = new Student();
  48.             studenty.push_back(student);
  49.  
  50.             //Student * studenciak;
  51.             //studenciak = studenciaki[i];
  52.             //studenciaki.push_back(studenciak);
  53.  
  54.             cin >> imie >> nazwisko >> numer_indeksu >> numer_zarejestrowanej_pracy_dyplomowej >> srednia_ze_studiow;
  55. //          studenciak->wpisz(imie, nazwisko, numer_indeksu, numer_zarejestrowanej_pracy_dyplomowej, srednia_ze_studiow);
  56.             student->wpisz(imie, nazwisko, numer_indeksu, numer_zarejestrowanej_pracy_dyplomowej, srednia_ze_studiow);
  57.             student->wypisz();
  58.         }
  59.  
  60.    
  61. }
  62. int main(){
  63.     zad7();
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement