Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- /*
- * Transformateur min -> maj de la première lettre des mots dans une phrase (un mot/2)
- * Utilisez "QUIT" pour forcer la boucle a s'arrêter
- */
- int main(void)
- {
- char s[100];
- int status=0;
- int loop=100;
- do {
- int i=0;
- printf("Entrez une chaine: ");
- gets(s);
- for (i=0;s[i]!='\0';i++)
- {
- if (strcmp(s, "quit")==0)
- {
- loop=120;
- printf("\nPreparing to logout...\n");
- scanf("%c",s);
- s[i]='\0';
- }
- else if (s[i]==' ') {
- i++;
- if (status==0) {
- status++;
- if (97<=s[i]) {
- s[i]-=32;
- }
- }
- else {
- status--;
- }
- }
- }
- if (loop == 100) {
- printf("'s'=%s\n",s);
- }
- } while (loop == 100 && loop != 120);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement