本文介绍了我想知道整数表示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
using System;
class Driver
{
static void Main()
{
int guess = 0;
Console.WriteLine ( "\nBefore guess: {0}", guess);
Console.WriteLine("0 or 1 ?");
guess = Console.Read();
Console.WriteLine ( "\nAfter guess: {0}", guess);
}
}
输出 在控制台中,当我按下0(零)时:
在猜测之前:0
0还是1?
0 zh
猜后:48
The output in console when I pressed 0(zero):
Before guess: 0
0 or 1 ?
0
After guess: 48
从哪里到48?生命的意义还是什么? (在一些小说中它是42):))
from where the heck comes 48? Meaning of life or something? (In some novel it was 42) :)
推荐答案
It converts the value returned by Console.Read() to its character representation.
IIRC,小说是"The Hitchhiker's Galaxy Guide"。 :)
IIRC, the novel was "The Hitchhiker's Guide to the Galaxy". :)
这篇关于我想知道整数表示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!