Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/redis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
(进程10072)已退出,代码为0。我的C#simple程序出错_C# - Fatal编程技术网

(进程10072)已退出,代码为0。我的C#simple程序出错

(进程10072)已退出,代码为0。我的C#simple程序出错,c#,C#,我做这个简单的程序 Console.WriteLine("Enter your name"); string name = Console.ReadLine(); Console.WriteLine("Please enter your age"); string age = Console.ReadLine(); while(age.Substring(0)

我做这个简单的程序

 Console.WriteLine("Enter your name");
            string name = Console.ReadLine();
            Console.WriteLine("Please enter your age");
            string age = Console.ReadLine();
            while(age.Substring(0) == "0") {
                Console.WriteLine("You enter invalid data");
                age = Console.ReadLine();
            }
            int realAge = Int32.Parse(age);
            Console.WriteLine(realAge);

            if (realAge > 18 && realAge < 17) {
                Console.WriteLine("So your name is ", name);
                Console.WriteLine("So you might a adult now");
            } else if (realAge < 17 && realAge > 12) {
                Console.WriteLine("So your name is " , name);
                Console.WriteLine("So you might a teenager");
            } else if (realAge > 4 && realAge < 11) {
                Console.WriteLine("So your name is " , name);
                Console.WriteLine("So you might a kid");
            } else if (realAge > 1 && realAge < 3) {
                Console.WriteLine("So your name is " , name);
                Console.WriteLine("So you might a baby");
            }
            Console.WriteLine("Hahah");
Console.WriteLine(“输入您的姓名”);
字符串名称=Console.ReadLine();
Console.WriteLine(“请输入您的年龄”);
string age=Console.ReadLine();
而(年龄子串(0)=“0”){
Console.WriteLine(“您输入的数据无效”);
age=Console.ReadLine();
}
int realAge=Int32.Parse(age);
控制台写入线(realAge);
如果(realAge>18&&realAge<17){
Console.WriteLine(“所以你的名字是”,name);
WriteLine(“所以你现在可能是成年人了”);
}否则如果(realAge<17和&realAge>12){
Console.WriteLine(“所以你的名字是”,name);
WriteLine(“所以你可能是个青少年”);
}否则如果(realAge>4&&realAge<11){
Console.WriteLine(“所以你的名字是”,name);
WriteLine(“所以你可能是个孩子”);
}否则如果(realAge>1&&realAge<3){
Console.WriteLine(“所以你的名字是”,name);
WriteLine(“所以你可能是个婴儿”);
}
Console.WriteLine(“哈哈”);
但是当我运行程序时,它会给我这个


而且它也没有经过我所做的if和else语句,我是C#的新手,所以这就是为什么嘿嘿。

如果你的程序以返回代码0结束,这意味着没有发生错误,它在结束时到达了
返回0

如果你的程序以返回代码0结束,这意味着没有发生错误,并在结束时返回到
返回0

您的程序刚刚结束,这是控制台应用程序所做的,除非它们已被编程为不允许。您可以使用
ReadKey
等待用户输入

...
Console.WriteLine("Hahah");
Console.ReadKey();

您的程序即将结束,这是控制台应用程序的功能,除非它们已被编程为不允许。您可以使用
ReadKey
等待用户输入

...
Console.WriteLine("Hahah");
Console.ReadKey();