Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace o
- {
- class Program
- {
- public static void Main(string[] args)
- {
- Console.WriteLine("phrase ?");
- string phrase = Console.ReadLine();
- string[] tabString = phrase.Split(' ');
- char[] tabChar = phrase.ToCharArray();
- int compteur = 1;
- //compter les mots
- for (int i = 0;i != tabChar.Length;i++)
- {
- if (tabChar[i] == ' ')
- {
- compteur++;
- }
- }
- Console.WriteLine("Il y a {0} mots\n",compteur);
- foreach (string mot in tabString)
- {
- Console.WriteLine(mot);
- }
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement