- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace _05结构
- {
- public struct Person
- {
- public string _name;//字段
- public int _age;
- public Gender _gender;
- }
- public enum Gender
- {
- 男,
- 女
- }
- class Program
- {
- static void Main(string[] args)
- {
- //XX大学管理系统
- //姓名、性别、年龄、年级 //5000 20000
- //string zsName = "张三";
- //int zsAge = 21;
- //char zsGender = '男';
- //int zsGrade = 3;
- string s = "123";
- Person zsPerson;
- zsPerson._name = "张三";
- zsPerson._age = 21;
- zsPerson._gender = Gender.男;
- Person lsPerson;
- lsPerson._name = "李四";
- lsPerson._age = 22;
- lsPerson._gender = Gender.女;
- Console.WriteLine(zsPerson._name);
- Console.WriteLine(lsPerson._name);
- Console.ReadKey();
- }
- }
- }
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace _10方法
- {
- class Program
- {
- static void Main(string[] args)
- {
- //闪烁 播放一段特殊的背景音乐 屏幕停止
- Program.PlayGame();
- Program.WuDi();
- Program.PlayGame();
- Program.PlayGame();
- Program.PlayGame();
- Program.PlayGame();
- Program.WuDi();
- Console.ReadKey();
- }
- /// <summary>
- /// 正常玩游戏
- /// </summary>
- public static void PlayGame()
- {
- Console.WriteLine("超级玛丽走呀走,跳呀跳,顶呀顶");
- Console.WriteLine("超级玛丽走呀走,跳呀跳,顶呀顶");
- Console.WriteLine("超级玛丽走呀走,跳呀跳,顶呀顶");
- Console.WriteLine("超级玛丽走呀走,跳呀跳,顶呀顶");
- Console.WriteLine("超级玛丽走呀走,跳呀跳,顶呀顶");
- Console.WriteLine("突然,顶到了一个无敌");
- }
- /// <summary>
- /// 无敌
- /// </summary>
- public static void WuDi()
- {
- Console.WriteLine("屏幕开始闪烁");
- Console.WriteLine("播放无敌的背景音乐");
- Console.WriteLine("屏幕停止");
- }
- }
- }
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace _11_方法练习
- {
- class Program
- {
- static void Main(string[] args)
- {
- //计算两个整数之间的最大值
- int max = Program.GetMax(1, 3);
- Console.WriteLine(max);
- // Array.Sort()
- // int n = Convert.ToInt32("123");
- string str = Console.ReadLine();
- Console.ReadKey();
- }
- /// <summary>
- /// 计算两个整数之间的最大值并且将最大值返回
- /// </summary>
- /// <param name="n1">第一个整数</param>
- /// <param name="n2">第二个整数</param>
- /// <returns>将最大值返回</returns>
- public static int GetMax(int n1, int n2)
- {
- return n1 > n2 ? n1 : n2;
- }
- }
- }