My program works correctly, but the output in the textbox should show it like this with every answer on a different line:
5 == 5
5 >= 5
5 <= 5
But it's putting everything on the same line like this:
5 == 55 >= 55 <=5
I've tried putting a newline character or a Console.WriteLine everywhere I can think of to no avail.
Here is the code:
5 == 5
5 >= 5
5 <= 5
But it's putting everything on the same line like this:
5 == 55 >= 55 <=5
I've tried putting a newline character or a Console.WriteLine everywhere I can think of to no avail.
Here is the code:
C#:
private void buttonCompare_Click(object sender, EventArgs e)
{
int firstNumber;
int secondNumber;
firstNumber = Convert.ToInt32(textBoxFirstInteger.Text);
secondNumber = Convert.ToInt32(textBoxSecondInteger.Text);
if (firstNumber == secondNumber)
{
textBoxAnswer.Text = textBoxAnswer.Text + firstNumber + " == " + secondNumber;
Console.WriteLine();
}
if (firstNumber != secondNumber)
{
textBoxAnswer.Text = textBoxAnswer.Text + firstNumber + " != " + secondNumber;
Console.WriteLine();
}
if (firstNumber < secondNumber)
{
textBoxAnswer.Text = textBoxAnswer.Text + firstNumber + " < " + secondNumber;
Console.WriteLine();
}
if (firstNumber > secondNumber)
{
textBoxAnswer.Text = textBoxAnswer.Text + firstNumber + " > " + secondNumber;
Console.WriteLine();
}
if (firstNumber <= secondNumber)
{
Console.WriteLine();
textBoxAnswer.Text = textBoxAnswer.Text + firstNumber + " <= " + secondNumber;
}
if (firstNumber >= secondNumber)
{
textBoxAnswer.Text = textBoxAnswer.Text + firstNumber + " >= " + secondNumber;
Console.WriteLine();
}
}