C#学习-10课时-方法

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

namespace ConsoleApp1

{

class Pro1

{

static void Main()

{

GetUserInfo();

GetUserInfo();

Console.ReadKey();

}

public static void GetUserInfo()

{

Console.WriteLine("请输入你的名字:");

string name = Console.ReadLine();

Console.WriteLine("请输入你的故乡:");

string address = Console.ReadLine();

Console.WriteLine("请输入你的年龄:");

string age = Console.ReadLine();

Console.WriteLine("请输入你的爱好:");

string hoby = Console.ReadLine();

name = change(name);

Console.WriteLine("名字输入为:" + name + " -01");

Console.WriteLine("故乡输入为:" + address + " -02");

}

static string change(string name1)

{

if (name1 == "YYB")

{

Console.WriteLine("你输入的是YYB");

name1 = "YYB本人";

}

else if (name1 == "李四")

{

Console.WriteLine("你输入的是李四");

name1 = "李四本人";

}

else

{

Console.WriteLine("请重新输入正确名字");

}

return name1;

}

}

}

相关推荐
Scout-leaf2 天前
WPF新手村教程(三)—— 路由事件
c#·wpf
用户298698530142 天前
程序员效率工具:Spire.Doc如何助你一键搞定Word表格排版
后端·c#·.net
mudtools3 天前
搭建一套.net下能落地的飞书考勤系统
后端·c#·.net
玩泥巴的3 天前
搭建一套.net下能落地的飞书考勤系统
c#·.net·二次开发·飞书
唐宋元明清21883 天前
.NET 本地Db数据库-技术方案选型
windows·c#
郑州光合科技余经理3 天前
代码展示:PHP搭建海外版外卖系统源码解析
java·开发语言·前端·后端·系统架构·uni-app·php
lindexi3 天前
dotnet DirectX 通过可等待交换链降低输入渲染延迟
c#·directx·d2d·direct2d·vortice
feifeigo1233 天前
matlab画图工具
开发语言·matlab
西岸行者3 天前
学习笔记:SKILLS 能帮助更好的vibe coding
笔记·学习
dustcell.3 天前
haproxy七层代理
java·开发语言·前端