hopingsteam

Untitled

Apr 7th, 2020
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstring>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. int rez = 0;
  9. char text[101] = "grus leucogeranus are 1,40 m inaltime si traieste intre 30 si 40 de ani";
  10. char *cuvant = strtok(text, " ");
  11. while(cuvant != NULL)
  12. {
  13. if(cuvant[0] >= '1' && cuvant[0] <= '9')
  14. {
  15. if(strchr(cuvant, ',') == NULL)
  16. rez++;
  17. }
  18. cuvant = strtok(NULL, " ");
  19. }
  20. cout << rez;
  21. return 0;
  22. }
Add Comment
Please, Sign In to add comment