由网友(:繁花笑.笑出倾国倾城)分享简介:我又碰到一个错误我的意思不是错误的人,但我对这个code得到一个错误:Again i run into an error i don't mean to bug anyone but I'm getting an error on this code:using System;using System.Colle...
我又碰到一个错误我的意思不是错误的人,但我对这个code得到一个错误:
Again i run into an error i don't mean to bug anyone but I'm getting an error on this code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Input_Program
{
class Program
{
private static void Main()
{
char Y;
char N;
Console.WriteLine("Welcome to my bool program!");
Console.WriteLine("Input a NON capital y or n when told to.");
if(Y == 'y')
{
Console.WriteLine("Thank you,Please wait.....");
}
}
}
}
感谢您的解答!
Thanks for you answers!
推荐答案
您变量字符是
使用前未初始化。尽量给声明时的默认值。
Your variable char Y
is not initialized before using. Try to give a default value when declaring.
修改看来你希望用户输入的东西,并把它分配给变量Y的尝试:
EDIT It seems that you want the users to input something, and assign it to the variable Y. Try:
Y = Console.ReadKey().KeyChar;
相关推荐
最新文章