【发布时间】:2018-05-04 02:32:03
【问题描述】:
在我的程序中 执行是打印一个未知字符 什么意思? 不知从何而来? 为什么要在控制台中打印它。 请帮忙... 我的代码在这里
static void Main(string[] args)
{
char[] array = new char[10];
for (int i = 0; i < 10; i++){
array[i] =(char) i;
}
for(int i = 0; i < 10; i++)
{
Console.Write(array[i] + "\n");
}
Console.Read();
}
这是一个简单的代码,但 c# 无法识别我的代码 更新 Windows 10 后,我的程序变成了它。 也许是更新 Windows 10 的问题?
执行我的代码是
http://uupload.ir/files/5tdi_problem_print_unknow_character.png
但大多数应该是 1 2 3 4 5 6 7 8 9
请帮帮我.. 坦克。 我该怎么做才能不写不相关的正方形? enter image description here
我执行的图片 http://s9.picofile.com/file/8312295492/problem_print_unknow_character.png
或 http://uupload.ir/files/5tdi_problem_print_unknow_character.png
【问题讨论】:
-
您正在打印无法打印的字符,您希望看到什么?
-
如果你能解释一下你认为代码应该做什么,那真的很有帮助,因为你几乎肯定是错的。
-
您正在打印此表中的项目 0-9。尝试遍历一些可打印的字符(如 48-57)。 asciitable.com
-
您要打印数字吗?如果是这样,请将您的数组更改为包含
int类型而不是char类型:int[] array = new int[10],并删除(char)演员表。这样你的数组是一个数字数组,而不是 ascii 字符。否则,请解释您要执行的操作,因为您的代码完全按照您的要求执行。
标签: c# arrays syntax-error console-application windows-update