Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstring>
- using namespace std;
- int main()
- {
- char text[101];
- cin.getline(text,101);
- int cifraMax = -1;
- int avemCifre = 0;
- int nr = 0;
- char cMax = NULL;
- char *cuvant = strtok(text, " ");
- while(cuvant != NULL)
- {
- if(cuvant[0] >= '0' && cuvant[0] <= '9')
- {
- char c = cuvant[0];
- if(c > cMax)
- {
- nr = 0;
- cMax = c;
- for(int i = 0; i < strlen(cuvant); i++)
- nr = nr * 10 + cuvant[i] - '0';
- }
- avemCifre = 1;
- }
- cuvant = strtok(NULL, " ");
- }
- if(avemCifre == 1)
- cout << nr;
- else
- cout << "nu exista";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement