摘要: using System;using System.Collections.Generic;using System.Linq;using System.Text;/* switch case * 类似于if...else....else if....else 但是离散值的判断 * switch一般都可以用if重写,但是if不一定能用switch重写 * 不要忘了break; C#中的break不写是不行的,除了合并case的情况 * * while循环 只要while后小括号中表达式为true,就不执行大括号中的代码 *///15SwitchCase whilenamespace _15S. 阅读全文
posted @ 2012-02-19 18:41 简单--生活 阅读(242) 评论(0) 推荐(0) 编辑
摘要: using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace _12if{ class Program { static void Main(string[] args) { //作业1: 提示用户输入密码,如果密码是"888888"则提示正确,否则提示错误 Console.WriteLine("请输入密码:"); //问题1,用户输入的是非数字的时候失败 ... 阅读全文
posted @ 2012-02-19 18:11 简单--生活 阅读(327) 评论(0) 推荐(0) 编辑
摘要: using System;using System.Collections.Generic;using System.Linq;using System.Text;/* 布尔运算 * 相等判断: ==, 不要和=混淆 * WriteLine("{0}",i==1); WriteLine("{0}",i=1); 的区别 * 不等判断!= * 大小比较< > <= >= * 取返: ! * 组合运算: && || */namespace _9布尔运算符{ class Program { static void Main 阅读全文
posted @ 2012-02-19 17:23 简单--生活 阅读(210) 评论(0) 推荐(0) 编辑
摘要: using System;using System.Collections.Generic;using System.Linq;using System.Text;/* 赋值运符=,让左边变量的值等于右边的计算结果,这就能解释令人不解的i = i+1; * (*)+=,-=, *= /= * i2 = i1++; i2=++i1; * */namespace 赋值运算{ class Program { static void Main(string[] args) { //习题: int a = 10; a++; a=a+a; ... 阅读全文
posted @ 2012-02-19 11:42 简单--生活 阅读(256) 评论(0) 推荐(0) 编辑
摘要: using System;using System.Collections.Generic;using System.Linq;using System.Text;/* 运算符,表达式 * + - * / % * +可以用作字符串连接,其他不可以 * ++ -- * */namespace _7算述运算符{ class Program { static void Main(string[] args) { //让用户输入两个数,打印出两个数的和 /*Console.WriteLine("请输入数值1:"); ... 阅读全文
posted @ 2012-02-19 11:33 简单--生活 阅读(203) 评论(0) 推荐(0) 编辑
摘要: using System;using System.Collections.Generic;using System.Linq;using System.Text;/* 变量的命名 * 命名规则: 第一个字符必须是字线或者下划线(_),基后的字符可以是任意个数字,字母,下划线 * 不用全部使用C#的关键字,比如class,nameespace,new void 等,判断方式: VS中亮蓝色的就是关键字 * 这也是类,函数等的命名规则 * 中文变量名(类中,函数名) * C#中建义变量开头用小写 * * */namespace _6变量的命名{ class Program { ... 阅读全文
posted @ 2012-02-19 11:22 简单--生活 阅读(197) 评论(0) 推荐(0) 编辑
摘要: using System;using System.Collections.Generic;using System.Linq;using System.Text;/* 简单的类型转换 Convert.ToString() ToString() Convert.Toint32(); * */namespace _4Convert类型转换{ class Program { static void Main(string[] args) { Console.WriteLine("请输入第一个字符:"); strin... 阅读全文
posted @ 2012-02-19 11:12 简单--生活 阅读(312) 评论(0) 推荐(0) 编辑
摘要: using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace _2字符串{ class Program { static void Main(string[] args) { //string s = "\"ab\""; //string s = "a\nb"; //n:newline //string s = "a\\b"; //string s... 阅读全文
posted @ 2012-02-19 11:02 简单--生活 阅读(144) 评论(0) 推荐(0) 编辑
摘要: using System;using System.Collections.Generic;using System.Linq;using System.Text;/* Virutal studio 是开发工具 * C# 是一种语言C Sharp * .Net Framework是提供函数库类库 * 创建第一个控制台程序并且调试运行 * 为什么要从控制台程序开始? 不要把精力放到表现层,而是把精力放在写代码上, * 无论控制台还是winform还是ASP.net最难的是写代码,而不是拖控件 * 唯一需要学的三条控制台指令,Console.WirteLine:打印输出 * Console.Rea 阅读全文
posted @ 2012-02-19 10:50 简单--生活 阅读(258) 评论(1) 推荐(1) 编辑
摘要: //13.7.1 对像指针问题(Object Pointer Problem)//13.7.2 对像指针的外套(The Coat of Object Pointer)//Sony Handle的应用/*#include "createsony.h"#include "sonyhandle.h"#include <iostream>enum{PUREFLAT, PLASMA, LIQUIDCRYSTAL, NANOMETER};void fsh(SonyHandle& sh){sh->adjustVolume();sh->s 阅读全文
posted @ 2012-02-18 23:54 简单--生活 阅读(420) 评论(0) 推荐(0) 编辑
简单--生活(CSDN)