Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #define nmax 101
- void popola(char s[]);
- void cambia(char s[], int l);
- void stampa(char s[], int l);
- int i;
- main(){
- int lu,n=nmax;
- char str[n];
- popola(str);
- lu=strlen(str);
- cambia(str,lu);
- stampa(str,lu);
- }
- void popola(char s[]){
- printf("Inserisci una frase stringa\n");
- gets(s);
- }
- void cambia(char s[], int l){
- s[0]=toupper(s[0]);
- for(i=1;i<l;i++){
- if(s[i-1]==' '){
- if(isupper(s[i])==0){
- s[i]=toupper(s[i]);
- }
- }else{
- s[i]=tolower(s[i]);
- }
- }
- }
- void stampa(char s[], int l){
- printf("\n\n%s",s);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement