c#循环yes

来源:百度知道 编辑:UC知道 时间:2024/07/05 13:02:52
static void Main(string[ ] args)
{
string email; // 电子邮件地址
Console.WriteLine("请输入你的邮箱:");
email = Console.ReadLine();
Console.WriteLine("你的邮箱是 {0}", email);
}

需实现的功能:
1、 输入 yes 时,程序循环执行
2、 兼容以下各种形式 yes(YES、yes、 YeS …..)
3、 提取邮箱的用户名

static void Main(string[] args)
{
lop:
string email; // 电子邮件地址
Console.WriteLine("请输入你的邮箱:");
email = Console.ReadLine();
Console.WriteLine("你的邮箱是 {0}", email);

// 询问是否继续
Console.WriteLine("是否要继续?");
string isGoon = Console.ReadLine();
isGoon = isGoon.ToLower();

// 判断条件,跳转
while ("yes" == isGoon)
{
goto lop;
}
}

using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
string email; // 电子邮件地址
lab: Console.WriteLine("请输入你的邮箱:");
email = Console.R