zoukankan      html  css  js  c++  java
  • IF的使用

     1 using System;
     2 using System.Collections.Generic;
     3 using System.Linq;
     4 using System.Text;
     5 using System.Threading.Tasks;
     6 
     7 namespace 第四个程序
     8 {
     9   class Program
    10   {
    11     static void Main(string[] args)
    12     {
    13 
    14       Console.WriteLine("请输入密码");
    15       string password = Console.ReadLine();
    16       if (password == "888")
    17         {
    18           Console.WriteLine("密码正确");
    19         }
    20       else
    21         {
    22           Console.WriteLine("请重新输入");
    23           password = Console.ReadLine();
    24           if (password == "888")
    25           {
    26             Console.WriteLine("密码正确");
    27           }
    28           else
    29           {
    30             Console.WriteLine("程序错误");
    31           }
    32         }
    33       Console.WriteLine("程序结束");
    34       Console.ReadKey();
    35 
    36     }
    37   }
    38 }

    运行效果:

  • 相关阅读:
    windows 程序设计的一些总结
    Ubuntu 16.04 LTS 安装开发工具
    C++ 虚函数表
    day 14 函数的嵌套,作用域
    命名空间(名称空间)
    day15编码
    day16迭代器
    day5
    day4
    day3
  • 原文地址:https://www.cnblogs.com/start-from-scratch/p/4979647.html
Copyright © 2011-2022 走看看