Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- #include <cstring>
- using namespace std;
- struct osoba{
- string imie;
- string nazwisko;
- int rok;
- int wiek;
- float stypN;
- float stypS;
- };
- osoba student [2];
- void wczytaj ()
- {
- for (int i=0; i<2; i++)
- {
- cout << "Podaj kolejno dane (imie, nazwisko, rok studiow, wiek, wysokosc stypendium naukowego i socjalnego) studenta numer "<<i+1<<endl;
- cin >> student[i].imie;
- cin >> student[i].nazwisko;
- cin >> student[i].rok;
- cin >> student[i].wiek;
- cin >> student[i].stypN;
- cin >> student[i].stypS;
- }
- }
- void wypisz ()
- {
- for (int i=0; i<2; i++)
- {
- cout << "Dane ucznia numer "<<i+1<<endl;
- cout << student[i].imie << " ";
- cout << student[i].nazwisko << ", ";
- cout << student[i].rok << " rok studiow, ";
- cout << student[i].wiek << " lat, wysokosc stypendium naukowego: ";
- cout << student[i].stypN << ", wysokosc stypendium socjalnego: ";
- cout << student[i].stypS << endl;
- }
- }
- void rok ()
- {
- int n;
- cout << "Podaj rok studiow "<<endl;
- cin >> n;
- for (int i=0; i<2; i++)
- {
- int dlugosc = student[i].nazwisko.length();
- if ((dlugosc-1=='i')&&(student[i].rok==n))
- {
- cout << "Dane szukanego studenta: " << endl;
- cout << student[i].nazwisko;
- cout << student[i].wiek << "lat";
- cout << student[i].rok << "rok studiow" << endl;
- }
- }
- }
- int main()
- {
- wczytaj ();
- system ("cls");
- wypisz ();
- rok ();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement