Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- int main()
- {
- int i,j,n;
- char str0[100],str1[40];
- // printf("Set size of string vector: \n");
- // scanf("%d",&n);
- for(j=0;j<40;j++){
- str1[j]='%';
- }
- printf("Let's play with something here...\n");
- printf("... type something so we can start it: \n");
- setbuf(stdin,NULL);
- fgets(str0,99,stdin);
- printf("\n... it encompasses %ld positions in the vector, that means, including 'ENTER' function",strlen(str0));
- printf("\n\nYou have typed:\n");
- fputs(str0,stdout);
- for(i=0;i<strlen(str0);i++){
- if(str0[i]=='l'){
- if(str0[i+1]=='e'){
- if(str0[i+2]=='m'){
- if(str0[i+3]=='i'){
- if(str0[i+4]=='n'){
- if(str0[i+5]=='s'){
- if(str0[i+6]=='k'){
- if(str0[i+7]=='y'){
- printf("Leminsky disse:\num homem com uma dor, é muito mais elegante\ncaminha assim de lado\ncomo se, chegando atrasado...\nandasse mais adiante!");
- }
- }
- }
- }
- }
- }
- }
- // strcat(str1,str0);
- }
- }
- // strcpy(str1,str0);
- setbuf(stdin,NULL);
- printf("\n\n... and in the str1 it should also read: \n");
- strcpy(str1,str0);
- for(j=0;j<strlen(str0);j++){
- if(str0[j]=='a'||str0[j]=='e'||str0[j]=='i'||str0[j]=='o'||str0[j]=='u'){
- str1[j-1]='*';
- str1[j]='*';
- }
- }
- fputs(str1,stdout);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment