Advertisement
glafyn77

Untitled

Feb 17th, 2020
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.47 KB | None | 0 0
  1. #include "pch.h"
  2. #include <iostream>
  3. #include <string>
  4. #include <sstream>
  5. using namespace std;
  6. int main()
  7. {
  8.     int doubleCounter = 0;
  9.     for (int i = 100; i < 1000; i++)
  10.     {
  11.         string t = "";
  12.         stringstream someStream;
  13.         someStream << i;
  14.         t = someStream.str();
  15.         if (t[0] == t[1] || (t[0] == t[2]) || (t[1] == t[2]));
  16.         {
  17.  
  18.  
  19.             doubleCounter++;
  20.             cout << "Got number with double digits:\t " << i << endl;
  21.         }
  22.        
  23.     }
  24.     cout << "Summary: " << doubleCounter << endl;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement