using System;
public class MainClass {
public static void Main(string[] args) {
string sSentence = "";
for (; ; ) {
Console.WriteLine("Enter a string");
string sLine = Console.ReadLine();
if (IsTerminateString(sLine)) {
break;
}
sSentence = String.Concat(sSentence, sLine);
Console.WriteLine("\nYou've entered: {0}", sSentence);
}
}
public static bool IsTerminateString(string source) {
string[] sTerms = {"EXIT","exit","QUIT","quit"};
foreach (string sTerm in sTerms) {
if (String.Compare(source, sTerm) == 0) {
return true;
}
}
return false;
}
}
|