Advertisement
Kentoo

N#1

Dec 18th, 2017
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.80 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.     cout << endl;
  16.     cout << numbers << endl;
  17.     cout << "Список номеров Подмосковья" << endl;
  18.     cout << endl;
  19.     while (numbers.length() > 0) {
  20.         numbers.copy(s1, 9, 0);
  21.         if (s1[8] == ' ') {
  22.             numbers.erase(0, 9);
  23.             s2[0] = s1[6];
  24.             s2[1] = s1[7];
  25.         }
  26.         else {
  27.             numbers.erase(0, 10);
  28.             s2[0] = s1[7];
  29.             s2[1] = s1[8];
  30.         }
  31.         if ((s2[0] == '5' || s2[0] == '9') && (s2[1] == '0'))
  32.             cout << s1 << endl;
  33.     }
  34.     system("pause");
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement