Kentoo

N#5

Dec 21st, 2017
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.88 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <iostream>
  3. #include <locale>
  4.  
  5. using namespace std;
  6.  
  7. void main()
  8. {
  9.     setlocale(LC_ALL, "Russian");
  10.     string numbers/* = "A123AA50 A435BB20 C413KA150 E184PO90 A372OP50 K562AP55 H555HH50 X987EH89 P234EX150 X778YO777 "*/;
  11.     char s1[10];
  12.     char s2[2];
  13.     s1[9] = '\0';
  14.     cout << "Введите номера" << endl;
  15.     getline(cin, numbers);
  16.     /*cout << "Список номеров:" << endl;
  17.     cout << endl;
  18.     cout << numbers << endl;*/
  19.     cout << "Список номеров Подмосковья" << endl;
  20.     cout << endl;
  21.     while (numbers.length() > 0) {
  22.         numbers.copy(s1, 9, 0);
  23.         if (s1[8] == ' ') {
  24.             numbers.erase(0, 9);
  25.             s2[0] = s1[6];
  26.             s2[1] = s1[7];
  27.         }
  28.         else {
  29.             numbers.erase(0, 10);
  30.             s2[0] = s1[7];
  31.             s2[1] = s1[8];
  32.         }
  33.         if ((s2[0] == '5' || s2[0] == '9') && (s2[1] == '0'))
  34.             cout << s1 << endl;
  35.     }
  36.     system("pause");
  37. }
Add Comment
Please, Sign In to add comment