Přidat otázku mezi oblíbenéZasílat nové odpovědi e-mailem C - počet slov

Jedno z možných (kompletních) řešení:

#include "stdafx.h"
#include <stdio.h>
#include <ctype.h>

int main()
{
	char string[100];
   int c = 0;
   int pocetMezer = 0;
 
   printf("Vlozte svuj text s mezerama (max 99 znaku) \n");
   gets(string);
  
   string[0] = toupper(string[0]);  // zvetseni prvniho pismena 

   while ( string[c] != '\0' )
   {
      
 
      if ( string[c] == ' ' ) 
	  {
         pocetMezer++;
         string[(c+1)] = toupper(string[(c+1)]);
	  }
      c++;
   }
   printf("\nPocet mezer: %d\n Pocet slov: %d \nZadana veta s velkymi pismeny slov: %s", pocetMezer, pocetMezer+1, string);
     
     
	 gets(string); // pauznuti
	return 0;
}

Reakce na odpověď

1 Zadajte svou přezdívku:
2 Napište svou odpověď:
3 Pokud chcete dostat ban, zadejte libovolný text:

Zpět do poradny