ECHO program in C#
i'm trying to make a program in C# that behaves like the well-known echo
command. Everything works fine except when I try to print a quoted String.
For example, in the echo command you type:
echo "Hello, world!"
And you get as output:
"Hello, world"
But when I run my program I get:
Hello, world!
This is the code:
using System;
namespace CSharpEcho
{
public class Echo
{
public static void Main(String[] argv)
{
Int32 ArgsLength = argv.Length;
if(ArgsLength == 0)
Console.WriteLine("You have to write something!");
else
{
String Str = "";
foreach(String args in argv)
{
Str += args + " ";
}
Console.WriteLine(String.Format("{0}", Str));
}
}
}
}
No comments:
Post a Comment