Advertisement
GarikK

Untitled

Feb 17th, 2020
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.62 KB | None | 0 0
  1. // homework_1702020.cpp:
  2. //
  3.  
  4. #include "pch.h"
  5. #include <iostream>
  6. #include <string>
  7. #include <sstream>
  8. using namespace std;
  9. int main()
  10. {
  11.     //vtoraya zada4a
  12.     /*int x, y, z;
  13.     cin >> x >> y;
  14.     z = x;
  15.     for (int i = 1; i < y; i++)
  16.     {
  17.         z *= x;
  18.     }
  19.     cout << z;*/
  20.     int doubleCounter = 0;
  21.     for (int i = 100; i < 1000; i++)
  22.     {
  23.         string t = "";
  24.         stringstream someStream;
  25.         someStream << i;
  26.         t = someStream.str();
  27.         if ((t[0] == t[1]) || (t[0] == t[2]) || (t[1] == t[2]) )
  28.         {
  29.             doubleCounter++;
  30.             cout << "Got number with double digits:\t" << i << endl;
  31.  
  32.         }
  33.     }
  34.     cout << "summary: " << doubleCounter << endl;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement