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 -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -