Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.74 KB | None | 0 0
  1. // qq.cpp : Defines the entry point for the console application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include <iostream>
  6. #include <sstream>
  7. #include <string>
  8. #include <fstream>
  9. using namespace std;
  10.  
  11. int main()
  12. {
  13.     setlocale(LC_ALL, "rus");
  14.     string str = "";
  15.     string str1,str2,str3 = "";
  16.     int a,b,c;
  17.     int k = 0;
  18.     ifstream input("123.txt");
  19.     while(getline(input,str))
  20.     {
  21.         if(str[0] == 'О')
  22.         {
  23.             str1 = str[str.length() - 1];
  24.             str2 = str[str.length() - 2];
  25.             str3 = str[str.length() - 3];
  26.             int a = atoi(str1.c_str());
  27.             int b = atoi(str2.c_str());
  28.             int c = atoi(str3.c_str());
  29.             int d = c*100 + b*10 + a;
  30.             if (d > 254) {
  31.                 cout << d << endl;
  32.                 k++;
  33.             }
  34.         }
  35.     }
  36.     cout << k << endl;
  37.     system("pause");
  38.     return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement