Advertisement
a53

Cuvinte9

a53
Jan 3rd, 2019
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstring>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. char a[101],cuv[101][101],*p,separator[]=" ";
  8. cin.get(a,101);
  9. p=a;
  10. p=strtok(p,separator);
  11. int nr=0;
  12. while(p)
  13. strcpy(cuv[++nr],p),p=strtok(NULL,separator);
  14. char pc='0';
  15. int poz=0;
  16. for(int i=1;i<=nr;++i)
  17. if(isdigit(cuv[i][0])&&cuv[i][0]>pc)
  18. pc=cuv[i][0],poz=i;
  19. if(poz)
  20. cout<<cuv[poz]<<'\n';
  21. else
  22. cout<<"nu exista\n";
  23. return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement