Advertisement
GAMELASTER

Untitled

Nov 25th, 2015
261
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.93 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int cislo = 0;
  8.     cin >> cislo;
  9.     string cisla[] = { "","jeden", "dva", "tri","styri", "pet", "sest","sedem","osem","deved" };
  10.     int tempCislo = cislo;
  11.     int digits = 0; do { tempCislo /= 10; digits++; } while (tempCislo != 0);
  12.     cout << digits << endl;
  13.     int tempCislo3 = cislo;
  14.  
  15.     int len = 0;
  16.  
  17.     int cislaArr[digits - 1];
  18.     //2
  19.     //13
  20.     //158
  21.     //1459
  22.     for(int i = 0; i < digits; i++)
  23.     {
  24.         int ciss = tempCislo3 % 10;
  25.         tempCislo3 /= 10;
  26.         cislaArr[3 - i] = ciss;
  27.     }
  28.  
  29.     for(int i = 0; i < digits; i++)
  30.     {
  31.         int cislica = cislaArr[i];
  32.         //1000
  33.         if((digits - i) == 4)
  34.         {
  35.             len += 5;
  36.             if(cislica != 1)
  37.             {
  38.                 //tisic
  39.                 len += 5;
  40.                 len += cisla[cislica].length();
  41.             }
  42.         }
  43.     }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement