Counting number of words in a string - c# program, DOT NET Programming

Counting Number of Words in a String - C# Program

Anyone can suggest me the output of the following program.

using System;  

class CountWords

{

public static void Main()

{

string s = ""; // Declare 's' of string type  

Console.Write("Enter the string : ");    

S = Console.ReadLine(); // Read string from the console & save in 's'    

string [] words = s.Split(null);

// 'words' is an array of string type

// string 's' will split when a space (null) is encountered

// This will be saved into array words     

int i = words.Length; // Just count the lenght of array 'words'  

Console.WriteLine("The total number of words in the entered string : "+i);    

Console.ReadLine();

}

}

Posted Date: 2/12/2013 1:26:13 AM | Location : United States





This a very easy example... the output is:

 Enter the string : Daljit is making programs
 The total number of words in the entered string : 4

Posted by laura | Posted Date: 2/12/2013 1:27:49 AM


Related Discussions:- Counting number of words in a string - c# program, Assignment Help, Ask Question on Counting number of words in a string - c# program, Get Answer, Expert's Help, Counting number of words in a string - c# program Discussions

Write discussion on Counting number of words in a string - c# program
Your posts are moderated
Related Questions
Project Description: We are seeking experienced .NET developers (possibly certified) to work with us on several future projects. You will have to pass a simple test to be consid

Project Description: I need to get lync server 2013 fixed the issues it has hit: 1) Can't connect to it outside network, I think small firewall problem with a little issue in

Encripter-Decripter application Project Description: I want an application which can encrypt - decrypt text, images, and music files as well as videos. Skills required are

Can we run DOT.NET in UNIX platform? One of the drawbacks of using Visual Studio.NET and the .NET framework to develop applications has been the lack of cross-platform support.

ASP Programmer I need a fixing all W3c validation errors and it is a ASP website. Have any queries please send a message and I will provide more information on project. De

What's difference between "Optimistic" and "Pessimistic" locking? In the pessimistic locking when user wants to update a data it locks the record and till then no one can updat

Briefly explain the characteristics of reference-type variables that are supported in the C# programming language. The variables that are based on reference types keeps referen

Required Experienced dot Net., JSP, PHP, Java Programmers Skilled professional and command in Programming either any one of the given mentioned programming coding with database

What is XSLT? The XSLT is a rule based language used to transform XML documents into other file formats. The XSLT are nothing but generic transformation rules which can be appl

What is a Hash Table? You can access an array using the INDEX value of that array, but how many times you know the real value of the index. The Hashtable provides a way of acce