Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstring>
- using namespace std;
- int main()
- {
- char a[101],cuv[101][101],*p,separator[]=" ";
- cin.get(a,101);
- p=a;
- p=strtok(p,separator);
- int nr=0;
- while(p!=NULL)
- {
- nr++;
- strcpy(cuv[nr],p);
- p=strtok(NULL,separator);
- }
- char pc='0';
- int poz=0;
- for(int i=1;i<=nr;++i){ ///iau toate cuvintele si verific
- ///daca este numar si are prima cifra max
- if((cuv[i][0]>='0' && cuv[i][0]<='9')&&cuv[i][0]>pc)
- pc=cuv[i][0],poz=i;
- }
- if(poz!=0)
- cout<<cuv[poz]<<'\n';
- else
- cout<<"nu exista\n";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement