using System;
namespace Console_Method_returns_Array
{
class Program
{
string[] GetWords(string phrase)
{
string[] arrWords = phrase.Split(' ');
return arrWords;
}
static void Main(string[] args)
{
string quote = "Money is human happiness in the abstract; he, then, who is no longer capable of enjoying human happiness in the concrete devotes himself utterly to money.";
Program p = new Program();
string[] words = p.GetWords(quote);
foreach (string word in words)
{
Console.WriteLine(word.Replace(",","").Replace(";","").Replace(".",""));
}
}
}
}
OUTPUT
Money
is
human
happiness
in
the
abstract
he
then
who
is
no
longer
capable
of
enjoying
human
happiness
in
the
concrete
devotes
himself
utterly
to
money
No comments:
Post a Comment