Advertisement
Guest User

Untitled

a guest
Sep 19th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.15 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include <string>
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     vector <string> poljeIme;
  9.     vector <string> poljePrezime;
  10.     vector <int> poljeGodine;
  11.     char ponovi;
  12.  
  13.     do
  14.     {
  15.         cout << endl;
  16.  
  17.         string ime;
  18.         cout << "Ime: ";
  19.         cin >> ime;
  20.         poljeIme.push_back(ime);
  21.  
  22.         string prezime;
  23.         cout << "Prezime: ";
  24.         cin >> prezime;
  25.         poljePrezime.push_back(prezime);
  26.  
  27.         int godine;
  28.         cout << "Godine: ";
  29.         cin >> godine;
  30.         poljeGodine.push_back(godine);
  31.        
  32.         cout << endl;
  33.  
  34.         cout << "Dodati jos osoba (d/n): ";
  35.         cin >> ponovi;
  36.     } while (ponovi == 'd' || ponovi == 'D');
  37.  
  38.     cout << endl;
  39.     int redniBroj = 0;
  40.  
  41.     do
  42.     {
  43.         cout << "Redni broj osobe cije informacije zelite ispisati [1-" << poljeIme.size() << "]: ";
  44.         cin >> redniBroj;
  45.  
  46.         if (redniBroj < 1 || redniBroj > poljeIme.size())
  47.             cout << "Krivo unesen redni broj." << endl;
  48.     } while (redniBroj < 1 || redniBroj > poljeIme.size());
  49.    
  50.     cout << endl;
  51.     cout << "Ime: " << poljeIme[redniBroj - 1] << endl;
  52.     cout << "Prezime: " << poljePrezime[redniBroj - 1] << endl;
  53.     cout << "Godine: " << poljeGodine[redniBroj - 1] << endl;
  54.     cout << endl;
  55.  
  56.     return 0;
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement