Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string.h>
- using namespace std;
- void cuv(char s[256])
- {
- char *p;
- int k=0;
- cin.get(s,256);
- p=strtok(s," ");
- while(p)
- {
- if(strchr(p,'a'))
- k++;
- p=strtok(NULL," ");
- }
- cout<<k;
- }
- void abreviere(char s[256])
- {
- char *p,s1[256];
- int i=0;
- cin.get(s,256);
- p=strtok(s," ");
- while(p)
- {
- if(p[0]>='A' && p[0]<='Z')
- {
- s1[i]=p[0];
- i++;
- }
- p=strtok(NULL," ");
- }
- s[i]=NULL;
- cout<<s1;
- }
- void invLit(char s[256])
- {
- char *p,aux,s1[256]="";
- cin.get(s,256);
- p=strtok(s," ");
- while(p)
- {
- if(strlen(p)>=3)
- {
- aux=p[0];
- p[0]=p[strlen(p)-1];
- p[strlen(p)-1]=aux;
- }
- strcat(s1,p);
- strcat(s1," ");
- p=strtok(NULL," ");
- }
- s1[strlen(s1)-1]=NULL;
- strcpy(s,s1);
- cout<<s;
- }
- int main()
- {
- char s[256];
- invLit(s);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement