Read 3 variables on the same line C# -
this question has answer here:
- is there equivalent 'sscanf()' in .net? 8 answers
i have question. work on console application , read 3 variable on same line.
with language c can write this
int a; string b; int c; scanf("%d %s %d", &a, &b, &c);
when start program write : 1+1 on same line , = 1 b = "+" c = 1
how can make same in c# console.readline() ?
thank in advance,
nico
this answer modified reading 2 integers in 1 line using c#. can several ways described in answer, suggest like:
//read line, , split whitespace array of strings string[] scanf= console.readline().split(); //parse element 0 int = int.parse(scanf[0]); //parse element 1 string b = scanf[1]; //parse element 2 int c = int.parse(scanf[2]);
i suggest following link there more ways described.
Comments
Post a Comment