课堂上老师讲了几点,自己觉得挺重要的,记录下来

1、代码字体调大,方便调试

2、虚心请教,没有谁比谁厉害,不会就虚心多请教,baidu并不能解决所有问题。沟通交流也是一种能力

3、只有每行写对了,才继续往下写,写的时候必须善用“Tab”键。

4、多写笔记,善于利用“便签”,“时间管理”

1、代码自动缩进


2、选择结构

a、if …… else if …… else

if()
{
.........
}
else if()
{
.........
}
else()
{
.........
}

b、switch 语句

 using System;
using System.Collections.Generic;
using System.Linq;
using System.Text; namespace MyProject
{
class Program
{
static void Main(string[] args)
{
// 提示词是得分点
Console.WriteLine("请输入一个数字"); // Parse , 语句嵌套 实现 输入数字 赋给 x
int x = int.Parse(Console.ReadLine()); // 注意不能直接定义而不给初始值
string res = "";
//Console.WriteLine(x); if( x < || x > )
{
Console.WriteLine("您输入的数字不合法");
}
else
{
switch (x / )
{
case :
case : res = "A"; break;
case : res = "B"; break;
case : res = "C"; break;
case : res = "D"; break;
default: res = "E";break;
}
Console.WriteLine("{0}的等级为:{1}",x,res);
}
}
}
}

Array类的使用,以及Random类的使用

 using System;
using System.Collections.Generic;
using System.Linq;
using System.Text; namespace MyProject
{
class Program
{
static void Main(string[] args)
{
// 随机数,Random , 系统提供类
Random R = new Random();
int[] a = new int[];
for( int i = ; i < ; i++)
{
// Next 返回一个 Next( Int32 ) -> 随机生成小于 101 非负整数。
// Next ( L , R ) 随机生成 [L,R)里面的整数的
a[i] = R.Next();
//a[i] = R.Next(1, 3);
if ((i + ) % == ) Console.WriteLine() ;
} // foreach -> 针对里面赋值了的元素进行输出
foreach (var item in a )
{
Console.Write( "{0}\t",item );
}
Console.WriteLine( "\n______________" );
Console.WriteLine(); // Array 类自带排序
Array.Sort(a);
foreach (var item in a)
{
Console.Write("{0}\t", item);
}
Console.WriteLine("\n______________");
Console.WriteLine(); // Array 数组的逆置
Array.Reverse(a);
foreach (var item in a)
{
Console.Write("{0}\t", item);
} //[,] 加逗号划分维度
int[,] B = new int[, ]; Console.WriteLine("\n_______________"); //返回整个数组的大小
Console.WriteLine( B.Length ); //返回数组的维度
Console.WriteLine( B.Rank ); //返回数组 两个不同维度的长度
Console.WriteLine( B.GetLength() );
Console.WriteLine( B.GetLength() );
}
}
}

String 类的Split使用

 using System;
using System.Collections.Generic;
using System.Linq;
using System.Text; namespace MyProject
{
class Program
{
static void Main(string[] args)
{
string s = "1 2 3 4 , 5 ,6 7 . 5 4";
char[] t = new char[] { ',', '.', ' ' };
string[] str1 = s.Split( t , StringSplitOptions.RemoveEmptyEntries);
string[] str2 = s.Split( new char[] { ',','.',' '} , StringSplitOptions.RemoveEmptyEntries);
foreach (var item in str1 )
{
Console.WriteLine("{0}",item);
}
}
}
}

最新文章

  1. MD5
  2. ZeroMQ接口函数之 :zmq_strerror - 获取ZMQ错误描述字符串
  3. CSS3属性border-radius绘制多种多样的图形
  4. 自定义ActionBar
  5. web端视频直播网站的弊端和优势
  6. 注解配置springMvc及向作用域中赋值
  7. UVA 562 Dividing coins (01背包)
  8. C++(MFC)
  9. Java Script 正则表达式的使用示例
  10. POJ 2395 Out of Hay(最小生成树中的最大长度)
  11. Scala AOP
  12. MySQL Flush Data
  13. MySQL:参数wait_timeout和interactive_timeout以及空闲超时的实现【转】
  14. swagger.net 使用nginx 代理时出现端口号导致出错
  15. 【强大精美的PS特效滤镜合集】Alien Skin Eye Candy for Mac 7.2.2.20
  16. 小甲鱼Python第二十讲课后习题---021
  17. 查看 设置mysql时区
  18. PHP5.4.0新特性研究
  19. HTML DOM学习
  20. SQL SERVER 一个SQL语句的执行顺序

热门文章

  1. 深入理解JVM虚拟机1:JVM内存的结构与永久代的消失
  2. 实现一个简单的Tomcat
  3. unctf esayrop wp
  4. 2018-2019-2 《网络对抗技术》Exp8 Web基础 Week11-12 20165233
  5. SQLite3中的日期时间函数使用小结
  6. Android:修改连接到AP端显示的设备名
  7. Bitmap之getPixel和setPixel函数
  8. HTML5Audio/Video全解(疑难杂症)
  9. 阶段5 3.微服务项目【学成在线】_day16 Spring Security Oauth2_10-SpringSecurityOauth2研究-校验令牌&amp;刷新令牌
  10. ReentrantLock、Condition结合使用实现多线程通讯