- 博客(21)
- 收藏
- 关注
原创 lwj_C#_输入年月日,写方法输出它是今年的第几天;
public class Year { public static int DayOfYear(int year, int month, int day) { int i = 1; int sumDay = day; while (i month)
2017-12-21 18:12:07 822
原创 lwj_C#_集合的使用、接口方法的实现;
using System;using System.Collections;using System.Collections.Generic;using System.Diagnostics;namespace homework{ //枚举能不能做//枚举如何实现 public class MyList T>:I
2017-12-21 11:42:26 159
原创 lwj_C#_作业 List<T>应用
List stus = new List (); while (true) { Student stu = new Student (); Console.WriteLine ("请输入学号:"); stu.no = int.Parse (Console.ReadLine
2017-12-20 20:58:05 195
原创 lwj_C#_字典
//字典 相当于前面是索引,后面是值 成对存在 Dictionarystring, int> stu = new Dictionarystring, int>(); stu.Add("蒋凯", 25); stu.Add("Jack", 20); stu.Add("蒋凯SB", 18);
2017-12-20 16:34:16 145
原创 lwj_C#_集合list<T>
using System;using System.Collections.Generic;using System.Collections;namespace Application{ class MainClass { public static void Main(string[] args) {
2017-12-20 10:37:42 164
原创 lwj_C#_集合stack栈和queue队列
using System;//使用集合时要先引入命名空间//使用非泛型时引用的命名空间using System.Collections;//使用泛型时引用的命名空间using System.Collections.Generic;namespace Application{ class MainClass { publi
2017-12-19 15:04:00 142
原创 lwj_C#_泛型使用
public static class Test2 { //数组 转成(拼接) 字符串; public static string CompoundStringT>(T[] arr) { string str = "";//null; foreach (T t in arr)
2017-12-18 16:05:16 207
原创 lwj_C#_接口
public interface IUSB { //默认public 只能是public void Read (); void Write(string str); int speed{ get;} } //右键接口名,实现接口里面的方法; public class KeyBroa
2017-12-16 14:30:45 151
原创 lwj_C#_静态,单例的使用
public class Info{ public string name; public int level; public int exp; private Info (){} private static Info instance; public static Info Inst
2017-12-14 16:50:03 190
原创 lwj_C#_周总结2 字符串练习
string str = "Because of you i never stray to far from the sidewalk"; string [] str_1 = str.Split (' '); string new_str = "";//空字符串==长度为0 和null不同 for (int i
2017-12-12 09:44:14 153
原创 lwj_C#_类的相互使用和构造方法
public enum Gender{ man, woman } public enum Course{ Math, Chinese, English, History, Physic } public class Teacher{
2017-12-08 15:27:52 182
原创 lwj_C#_方法重载,递归,构造
class Text{// //方法重载// public int Mulit(int a, int b){// return a * b; // }// public float Mulit( float a, float b){// return a * b;
2017-12-07 15:44:57 149
原创 lwj_C#_work 字符串、类的使用和数学运算
// // 1、定义分数(Fraction)类: // // (1)成员变量// // 私有字段以及可读可写属性:分子、分母// // (2)成员方法:// // * 打印分数信息(例如: 1 / 3)
2017-12-07 11:39:36 363
原创 lwj_C#_string类方法 可变字符串
// //string字符串;// //string是个类;// //所有的方法都不会修改原来的字符串(原来字符串不会改变);// //string是一个特殊的引用类型;//// string name = "qw ea sww";// //c
2017-12-06 16:22:49 169
原创 lwj_C#_homework get set 属性
// //1、定义1个时间类Time,要求必须具有以下成员变量(属性)和方法:// //1).deltaTime属性,只具有get访问器,能够返回每一帧的时间(1/60秒);// //2).timeScale属性,具有get/set访问器,能够返回当前的时间比例(默认值为1);// //3).自定义一个方法,输出当前时间的比例,如果大于1,输出“快进”,如果小于
2017-12-06 09:29:25 311
原创 lwj_C#_homework 攻城车 攻击 WASD移动
// //建立一个位置结构体// public struct Position2D{// public int x;// public int y;// // } // // public class Battering1// {// public int ATK;/
2017-12-05 20:50:16 283
原创 lwj_C#_类的属性,方法参数 举例习题
// public class Hero// {// public string name;// //字段// private int age;// //属性 //属性里面不要使用属性本身;// public int Age{// get{ //
2017-12-05 17:36:16 452
原创 lwj_C#_建立一个数学MathTool类包含的方法
// class MathTool{// //1、判断一个数是不是偶数;// public void num(int n){// if (n % 2 == 0) {// Console.WriteLine ("这是一个偶数");// }else{//
2017-12-05 10:07:53 416
原创 lwj_C#_作业
public class Player// {// public Weapon weapon = Weapon.Dagger;// public void SetWeapon( Weapon n){// weapon = n;// }//// public string name;/
2017-12-04 19:36:45 159
原创 lwj_C#_排序
// //插入排序 //插入是稳定排序,选择是不稳定排序// int [] num = {12, 45, 23, 65, 234, 63};//// for (int i = 1; i num.Length ; i++) {// int temp = num[i];//
2017-12-04 19:31:56 182
原创 lwj_C#_周总结1
//1、C#程序结构有哪几种? //顺序结构 //条件结构 //循环结构 //2、有一个char类型变量ch写出代码判断大写小写 // if (a > 'a', a 'z') { //
2017-12-04 10:12:32 218
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人