Advertisement
STANAANDREY

26/11/2019

Nov 26th, 2019
263
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.58 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstring>
  3. #include <stdio.h>
  4. #include <cstdlib>
  5. #include <ctype.h>
  6. using namespace std;
  7.  
  8. int main()
  9. {
  10.     char s[11];
  11.     cin >> s;
  12.     int n = strlen(s), ok = 1;
  13.     for (int i = 0; i < n; i++)
  14.     {
  15.         if (!isdigit(s[i]))
  16.         {
  17.             if (s[i] == '.' && i != n - 4)
  18.                 ok = 0;
  19.             else if (s[i] != '.')
  20.                 ok = 0;
  21.         }
  22.  
  23.     }
  24.  
  25.     if (s[n - 4] != '.')
  26.         ok = 0;
  27.  
  28.     if (ok)
  29.         cout << s << " e numar";
  30.     else
  31.         cout << s << " nu e numar";
  32.  
  33.     return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement