Advertisement
Guest User

Untitled

a guest
May 23rd, 2017
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <ctype.h>
  4. #include <string.h>
  5.  
  6.  
  7. int main(){
  8. char str[100];
  9.  
  10. while(scanf("%[^\n]",str)!=EOF){
  11. getchar();
  12. //printf("%s\n",str);
  13. int flag=1,tam,i;
  14. tam=strlen(str);
  15. for(i=0;i<tam;i++){
  16. if(str[i]==' ');
  17. else if(flag){
  18. str[i]=toupper(str[i]);
  19. flag=0;
  20. }
  21. else{
  22. str[i]=tolower(str[i]);
  23. flag=1;
  24. }
  25. }
  26. printf("%s\n",str);
  27. }
  28.  
  29.  
  30.  
  31. return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement