那是应为Read()的返回只是int的, 字符'8'的编码是56, 所以输出56了
用ReadLine()就可以了:)
用ReadLine()就可以了:)
解决方案 »
- vs2005安装部署如何加入office
- C# DataGridView隐藏列问题
- 如何在程序中列出Excel表的列名?
- c#让从A窗体打开的B窗体关闭后再执行A窗体内的代码
- datagridview问题,困扰好久!
- c# 请问 FolderNameEditor类 怎么用?
- winform,数据库是MSDE,关于程序打包问题。
- datagridview 的一个问题!谢谢
- 请高手帮助解决报表问题?
- 我想佣ListView中的ColumnClick事件來打開ListView中ListViewItem裏面的所有目錄和文件,可是我的代碼沒有執行,不知道為什嗎??
- 窗体的KEYUP事件不响应呢??
- 关于怎样限制Click事件发生的方法?
[C#]
// From textReaderText, create a continuous paragraph
// with two spaces between each sentence.
string aLine, aParagraph = null;
StringReader strReader = new StringReader(textReaderText);
while(true)
{
aLine = strReader.ReadLine();
if(aLine != null)
{
aParagraph = aParagraph + aLine + " ";
}
else
{
aParagraph = aParagraph + "\n";
break;
}
}
Console.WriteLine("Modified text:\n\n{0}", aParagraph);
int a=Convert.ToInt32(Console.ReadLine());
因为string不能隐式转为int;
:)
int i = int.Parse(Console.ReadLine());
Console.Write("input a number:");
a=Convert.ToInt32(Console.ReadLine());
Console.WriteLine("the number is:{0}",a);