Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstring>
- using namespace std;
- int main()
- {
- char s[101] = "Reprezentat cu 4 zecimale PI este 13.1415 si e este 2.7182";
- char rez[101] = "";
- char *cuvant = strtok(s, ".");
- while(cuvant != NULL)
- {
- //cout << cuvant << "\n";
- int i1 = strlen(cuvant) - 1;
- while(cuvant[i1] >= '0' && cuvant[i1] <= '9')
- i1--;
- int i2 = 0;
- while(cuvant[i2] >= '0' && cuvant[i2] <= '9')
- i2++;
- //cout << i1 << " " << i2 << " ";
- cuvant[i1] = '\0';
- strcat(rez, cuvant+i2);
- cuvant = strtok(NULL, ".");
- }
- cout << rez;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement