Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstring>
- #include <fstream>
- #include <cstdlib>
- using namespace std;
- void Citire(char* s)
- {
- ifstream fin("text.in");
- fin.getline(s, 999);
- fin.close();
- }
- void ElimVoc(char* s)
- {
- int nr = strlen(s);
- char voc[] = "aeiou", *p;
- p = strtok(s, voc);
- while(p != NULL)
- {
- p = strtok(NULL, voc);
- }
- for(int i = 0; i < nr; i++)
- if(s[i] != 0) cout << s[i];
- }
- void SchLit(char* s)
- {
- int i = 0, lM = 1;
- while(s[i] != 0)
- {
- if(s[i] == ' '){ lM = 1; i++; }
- if(lM == 1)
- {
- if(s[i] >= 97) s[i] -= 32;
- lM = 0;
- }
- else
- if(s[i] < 97) s[i] += 32;
- i++;
- }
- }
- int SumCif(char* s)
- {
- int i = 0, sm = 0;
- char cuv[100][100], *p;
- p = strtok(s, " ");
- while(p != NULL)
- {
- strcpy(cuv[i], p); i++;
- p = strtok(NULL, " ");
- }
- for(int j = 0; j <= i; j++)
- {
- if(cuv[j][0] >= 48 && cuv[j][0] <= 57) sm += atoi(cuv[j]);
- }
- return sm;
- }
- void Secv(char* s)
- {
- int a, amx, b, bmx, lg, mx, i, lM;
- a = b = mx = lg = i = lM = 0;
- if(s[i] <= 90) lM = 1;
- while(s[i] != 0)
- {
- if(lM == 0)
- {
- if(lg > mx)
- {
- amx = a;
- bmx = b;
- }
- lg = 0;
- a = b = i+1;
- }
- else
- {
- lg++;
- b++;
- }
- if(s[++i] <= 90) lM = 1;
- else lM = 0;
- }
- for(int cuv = amx; cuv < bmx; cuv++)
- cout << s[cuv];
- }
- int main()
- {
- char s[1000];
- Citire(s);
- cout << s << "\n";
- //1
- /*
- ElimVoc(s);
- */
- //2
- /*
- SchLit(s);
- cout << s << "\n";
- */
- //4
- /*
- cout << SumCif(s);
- */
- //5
- /*
- Secv(s);
- */
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement