源代码:
using System;
using System.Collections.Generic; using System.Linq; using System.Text;
using System.Threading.Tasks;
namespace APP9 {
class Program {
static void Main(string[] args) { qw:
Console.Write(\"请输入用户名:\"); string Name = Console.ReadLine(); Console.Write(\"请输入用户密码:\"); string Pwd = Console.ReadLine();
if(Name==\"huangyanling\" & Pwd==\"123456\") {
Console.WriteLine(\"登录成功\"); } else {
Console.WriteLine(\"登录失败\"); }
if (Name != \"huangyanling\" || Pwd != \"123456\") {
goto qw; }
Console.ReadLine(); } } }
运行结果:
源代码:
using System;
using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text;
using System.Threading.Tasks;
1
using System.Windows.Forms;
namespace WindowsFormsApplication1 {
public partial class Form1 : Form {
public Form1() {
InitializeComponent(); }
private void Form1_Load(object sender, EventArgs e) {
}
private void button1_Click(object sender, EventArgs e) {
if(textBox1.Text==\"hyl\" && textBox2.Text==\"000000\") {
button1.Text=\"登录成功\"; }
else {
button1.Text=\"登录失败\"; }
}
private void label1_Click(object sender, EventArgs e) {
}
private void button2_Click(object sender, EventArgs e) {
Random rad = new Random();
int value = rad.Next(1000,9999); label6.Text = value.ToString(); } } }
运行结果图:
2
3