c# - Read user input from console -


i want number user multiple pi number number. tried thing below. a contains gibberish. example if insert 22, contains 50.

double a,b; = console.read(); b = * math.pi; console.writeline(b); 

i'm not sure problem (since haven't told us), i'm guessing @

a = console.read(); 

this read 1 character console.

you can change program this. make more robust, accept more 1 char input, , validate input number:

double a, b; console.writeline("istenen sayıyı sonuna .00 koyarak yaz"); if (double.tryparse(console.readline(), out a)) {   b = * math.pi;   console.writeline("sonuç " + b);  } else {   //user gave illegal input. handle here. } 

Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

reflection - How to access the object-members of an object declaration in kotlin -

php - Doctrine Query Builder Error on Join: [Syntax Error] line 0, col 87: Error: Expected Literal, got 'JOIN' -