122-练习1和2

1,在Main方法中定义变量,用这些变量存储游戏中一个敌人应该有的一些属性,定义尽可能多的变量。

int hp;
float x, y, z;
float speed = 12;

2,接受用户输入的两个整数,存储到两个变量里面,交换变量存储的值。

            string str1 = Console.ReadLine();
            int num1 = Convert.ToInt32(str1);
            string str2 = Console.ReadLine();
            int num2 = Convert.ToInt32(str2);
            int temp = num1;
            num1 = num2;
            num2 = temp;
            Console.WriteLine(num1+":"+num2);
            Console.ReadKey();

  

posted @ 2018-11-15 20:16  阿晖2222  阅读(207)  评论(0编辑  收藏  举报