本文整理汇总了C#中SimpleCalculator.Parse.getNumberTwo方法的典型用法代码示例。如果您正苦于以下问题:C# Parse.getNumberTwo方法的具体用法?C# Parse.getNumberTwo怎么用?C# Parse.getNumberTwo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SimpleCalculator.Parse
的用法示例。
在下文中一共展示了Parse.getNumberTwo方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
static void Main(string[] args)
{
Console.WriteLine("What is your name?");
string userName = Console.ReadLine();
Parse p = new Parse();
Evaluate e = new Evaluate();
bool run = true;
while (run)
{
Console.WriteLine(userName + " Define your mathematical operation");
string input = Console.ReadLine();
if (input.ToUpper() == "LASTQ")
{
Console.WriteLine(e.lastExpression());
run = false;
break;
}
string oper = p.getOperator(input);
int num1 = p.getNumberOne(input);
int num2 = p.getNumberTwo(input);
int answer = e.ExecuteMethod(num1, num2, oper);
Console.WriteLine("The answer to your operation is: " + answer);
}
Console.WriteLine("Press any key to exit");
Console.ReadLine();
}
示例2: EvaluateTestEnsureICanSubtract
public void EvaluateTestEnsureICanSubtract()
{
Evaluate e = new Evaluate();
Parse p = new Parse();
string input = "2 - 2";
int num1 = p.getNumberOne(input);
int num2 = p.getNumberTwo(input);
string oper = p.getOperator(input);
int expected = 0;
Assert.AreEqual(expected, e.ExecuteMethod(num1, num2, oper));
}
示例3: CommandEnsureICanGetReturnFromLastQCommand
public void CommandEnsureICanGetReturnFromLastQCommand()
{
Parse p = new Parse();
Evaluate e = new Evaluate();
string input = "2 + 2";
int num1 = p.getNumberOne(input);
int num2 = p.getNumberTwo(input);
string oper = p.getOperator(input);
int answer = e.ExecuteMethod(num1, num2, oper);
string expected = "2 + 2";
string actual = e.lastExpression();
Assert.AreEqual(expected, actual);
}
示例4: ParseEnsureICanGetSecondNumber
public void ParseEnsureICanGetSecondNumber()
{
Parse p = new Parse();
string input = "2+1";
Assert.AreEqual(1, p.getNumberTwo(input));
}