9 Replies
How can i listen for both of these numbers so i need to input 1 2 once
not, 1 and then 2
Like in C here:
int inputs = scanf("%d %d", &input1, &input2);
firstly just some general advice:
- use
int.Parse
and not Convert.ToInt32
- use string interpolation - Console.WriteLine($"Result {input1 + input2}");
If you wanted to take two inputs at once then you'd have to split the input on some kind of delimiter, for instance " "
or ", "
, then parse the two strings on either side
Something like Thanks
What if i want to define the operator (- or +)?
im trying char operator = '+'; but it doesnt work
?
oh you want to make a variable?
yes
var doesnt work either
operator
is a keyword
char op = '+';
worksoh i see
One more question please, in C for example, i need to put \n for the print /consolewrite to be on a new line
I see that on C# i dont need to put that, its automaically on a new line
but what if i want all on the same line
Use
Console.Write
Console.WriteLine
writes some text and then a newline, hence the nameThanks a lot