Advertisement
Skygen

uzd

Nov 12th, 2015
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.57 KB | None | 0 0
  1. // uzd.cpp : Defines the entry point for the console application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include <iostream>
  6. #include <conio.h>
  7. #include <string>
  8. #include <stdlib.h>
  9.  
  10. using namespace std;
  11.  
  12. int clientCount = 0, i, j;
  13. string name, surname;
  14.  
  15.  
  16. int main()
  17. {
  18.     cout << "Cik klientus ievadit?: ";
  19.     cin >> clientCount;
  20.  
  21.     string** clients = new string*[clientCount];        //dinamiskais divdimensiju masiivs
  22.                                                         //klientu informacijas saglabasanai
  23.     for (int i = 0; i < clientCount; ++i)
  24.         clients[i] = new string[4];
  25.  
  26.  
  27.  
  28.     for (i = 0; i < clientCount; i++)
  29.     {
  30.         cout << "==== " << i+1 << ". klients ====\n";
  31.  
  32.             cout << "Ievadiet klienta vardu: ";
  33.             cin >> clients[i][0];
  34.             cout << "Ievadiet klienta uzvardu: ";
  35.             cin >> clients[i][1];
  36.             cout << "Ievadiet klienta tel. nr: ";
  37.             cin >> clients[i][2];
  38.             cout << "Ievadiet klienta adresi: ";
  39.             cin >> clients[i][3];
  40.  
  41.  
  42.    
  43.     }
  44.  
  45.     system("cls");      // konsoles attirisana
  46.  
  47.     cout << "Ievadiet meklejama klienta vardu:";
  48.     cin >> name;
  49.     cout << "Ievadiet meklejama klienta uzvardu:";
  50.     cin >> surname;
  51.  
  52.     system("cls");
  53.  
  54.     cout << "Rezultati:\n";
  55.  
  56.     for (i = 0; i < clientCount; i++)
  57.     {
  58.  
  59.         if (name == clients[i][0] && surname == clients[i][1])
  60.         {
  61.             cout << "Vards: " << clients[i][0] << endl;
  62.             cout << "Uzvrads: " << clients[i][1] << endl;
  63.             cout << "Tel. nr: " << clients[i][2] << endl;
  64.             cout << "Adrese: " << clients[i][3] << endl;
  65.  
  66.         }
  67.         cout << endl;
  68.    
  69.     }
  70.  
  71.     for (int i = 0; i < clientCount; ++i) { //dinamiska masiva dzesana
  72.         delete[] clients[i];
  73.     }
  74.     delete[] clients;
  75.  
  76.     return 0;
  77. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement