//练习二
//输入用户名和密码,如果正确就显示,如果错误,提示"错误"
//WriteLine编进去的固定句子,如:“请输入用户名”
//ReadLine要求临时输入的句子,如:“zhangjie”
using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication2
{
class Program
{
///
/// 主方法,入口
/// ///
static void Main(string[] args)
{
Console.WriteLine("请输入用户名和密码");//首先用一个变量接受:
string userName = Console.ReadLine();//readLine中都空
string userPassword = Console.ReadLine();
if (userName == "zhangjie" && userPassword == "123456")
{
Console.WriteLine("用户名是:"+userName+"密码是:"+userPassword);
Console.Read();
}
else if (userName != "zhangjie" && userPassword == "123456")
{
Console.WriteLine("用户名不正确!请确认!");
Console.Read();
}
else if (userName == "zhangjie" && userPassword != "123456")
{
Console.WriteLine("密码不正确,请确认!");
Console.Read();
}
else
{
Console.WriteLine("用户名和密码都不正确");
Console.Read();
}
}
}
}
阅读(628) | 评论(0) | 转发(0) |