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
I need Job Posting Software for Schools Project Description: I want to create a software program that will automatically post a job to multiple schools. Let me know if you

What is scavenging? When server running your ASP.NET application runs low on the memory resources, items are discarded from the cache depending on cache item priority. The Cach


Describe the disconnected architecture of ADO.NET's data access model. ADO.NET maintains a disconnected database access model, which means, the application never remains linked

Briefly explain what user controls are and what server controls are and the differences among the two.   An ASP.NET control (sometimes known as a server control) is a server-si

MAT LAB programming Project Description: i have simulation and i need to simulate the equation in ,and test the all simulation it working with your work program other code sh

What is the DTD? The DTD is Document Type Definition that explains the formation of the content of an XML document. The DTD manages the data to keep in a consistent format. It

Checking for validity of an expression - C# Program Hello can you please provide me some examples regarding to the Checking for validity of an   expression in C#.

Passport authentication A centralized service given by Microsoft, offers a single logon point for clients. Unauthenticated users are redirected to the Passport site

When we create a private constructor, we can not create object of the class directly from the client. So you will use the private constructors whenever you do not want instances of