Print Functions added
This commit is contained in:
parent
41c0994878
commit
65c3ab8459
@ -116,7 +116,7 @@ namespace Assignment_1
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool List()
|
void List()
|
||||||
{
|
{
|
||||||
Console.WriteLine("┌" + new string('─', 49) + "┐");
|
Console.WriteLine("┌" + new string('─', 49) + "┐");
|
||||||
Console.WriteLine("│{0:-15}│{1:-25}│{2:9}│", "Symbol", "Value", "Flags");
|
Console.WriteLine("│{0:-15}│{1:-25}│{2:9}│", "Symbol", "Value", "Flags");
|
||||||
@ -134,7 +134,49 @@ namespace Assignment_1
|
|||||||
Console.WriteLine("├" + new string('─', 15) + "┼" + new string('─', 25) + "┼" + new string('─', 9) + "┤");
|
Console.WriteLine("├" + new string('─', 15) + "┼" + new string('─', 25) + "┼" + new string('─', 9) + "┤");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
void Exit()
|
||||||
|
{
|
||||||
|
Environment.Exit(0);
|
||||||
|
}
|
||||||
|
bool Print(Stream source, int mode=0)
|
||||||
|
{
|
||||||
|
string expression;
|
||||||
|
long result = FindExpression(source, out expression);
|
||||||
|
if (result < 0)
|
||||||
|
{
|
||||||
|
// Could not print
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (mode == 0)
|
||||||
|
{
|
||||||
|
Console.WriteLine(expression);
|
||||||
|
}
|
||||||
|
else if (mode == 1)
|
||||||
|
{
|
||||||
|
Console.Write("Length of the expression is: ");
|
||||||
|
Console.WriteLine(expression.Length);
|
||||||
|
}
|
||||||
|
else if (mode >= 2)
|
||||||
|
{
|
||||||
|
|
||||||
|
string[] words = expression.Split(' ');
|
||||||
|
if (mode == 3)
|
||||||
|
{
|
||||||
|
Console.Write("Wordcount is: ");
|
||||||
|
Console.WriteLine(words.Length);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Console.WriteLine("Words are:");
|
||||||
|
foreach (string word in words)
|
||||||
|
{
|
||||||
|
Console.WriteLine(word);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user