小编Awk*_*key的帖子

检查字符串是否与某些东西不相等

这是我的代码:

using System;

namespace FirstProgram
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            Console.WriteLine ("What is your first name?");
                String Name = Console.ReadLine ();
            Console.WriteLine ("\nHi " + Name + "! Now tell me are you a boy or girl?");
                String Sex = Console.ReadLine ();

            if (!Sex.Equals ("boy") || !Sex.Equals ("girl")) {
                Console.WriteLine ("\nERROR: You were supposed to type 'boy' or 'girl'\nPress any key to exit...");
                Console.ReadKey ();
                System.Environment.Exit (1);
            }

            Console.WriteLine ("\nOk so your name is " …
Run Code Online (Sandbox Code Playgroud)

c# string console

2
推荐指数
2
解决办法
6462
查看次数

标签 统计

c# ×1

console ×1

string ×1