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
What is Extensible Markup Language (XML). XML is an easy and flexible mark-up language in the text format. Nowadays, it is widely used to exchange a large variety of data over

What is Dynamic Language Runtime (DLR)? DLR is a runtime environment that permits you to integrate dynamic languages with the Common Language Runtime (CLR) by adding a set of s

What are the different types of replication supported by SQL SERVER? There are 3  types of replication supported by SQL SERVER which are shown below:- 1) Snapshot Replicati

How can you make a simple harmonic motion in visual basic 2010 where you will ask an input to the user and your output will be a moving pendulum and a graph. Also the displacement

Need a K2 Blackpearl workflows help Need a K2 Blackpearl workflows experienced developer to integrate in SharePoint 2010 and 2013. The workflow integrates with Navision 5 provid

What is the meaning of object pooling? Object pooling is a method of storing a pool (group) of objects in memory that can be reused later as needed. Whenever, a new object is n

What is a runtime engine? A runtime engine of WF gives the basic functionality to execute and manage the workflow lifetime. It runs within the host process and is responsible f

What are the precautions by which SQLSERVER Mode work properly Following are the things to keep in mind so that the SQLSERVER Mode works properly:- A) In the SQLSERVER mode,

How to Creating a Key Pair ? You can create a key pair using the Strong Name tool (Sn.exe). Key pair files usually have an .snk extension. To create a key pair At the comman

ASP.NET/MSSQL/ MVC completing backend solution + integrating with frontend. - repost Project Description: System is used for tracking company's activities through several pro