##百度文库##
##百度文库##
转义:
\\——\
\' ——'
\"——"
\?——?
\a——Alert or bell
\b——Backspace
\f——Form feed
\n——Newline
\r——回车
\t——水平制表符tab
\v——垂直制表符tab
\ooo——一到三位的八进制数
\xhh...——一个或多个数字的十六进制数
//练习2:2006年学院有80000人,每年增长25%,到哪一年人数达到20万。
int stu = 80000;
int year = 2006;
while (stu < 200000)
{
stu = (stu * 125 )/ 100;
year++;
}
Console.WriteLine(year);
int n = Convert.ToInt32(Console.ReadLine());
int cyc = 0;
while (n > 1)
{
if (n % 2 == 1) { n = 3 * n + 1; }
else { n = n / 2; }
cyc = cyc + 1;
}
Console.WriteLine(cyc);
int n1 = Convert.ToInt32(Console.ReadLine());
int n2 = Convert.ToInt32(Console.ReadLine());
while (n2 >= n1)
{
if (n2 % 2 == 0) { Console.WriteLine(n2); }
n2--;
}
while (n2 <= n1)
{
if (n1 % 2 == 0) { Console.WriteLine(n1); }
n1--;
}
风
你们的确定位置业务必须知道理解决定位置业务必须知道理解决定位置业务必须知道理解决定位置业务必须知道理解决定位置业务必须知
int a = Convert.ToInt32(Console.ReadLine());
int b = Convert.ToInt32(Console.ReadLine());
int c = Convert.ToInt32(Console.ReadLine());
if (a > b)
{
int max = a;
a = b;
b = max;
}
if (b > c)
{
int max = b;
b = c;
c = max;
}
if (a > b)
{
int max = a;
a = b;
b = max;
}
Console.WriteLine(a + " " + b + " " + c);
double m = Convert.ToDouble(Console.ReadLine());
int k = Convert.ToInt32(Console.ReadLine());
if (k == 0)
{
int number = (int)m;
Console.WriteLine(number);
} else if (k==1)
{
double number=((int)((m + 0.05) * 10)) / 10.0;
Console.WriteLine(number);
}
1.B
2.A
3.A
4.C
Console.ReadKey:读取一个键(肯嗖瑞德K)
Console.ReadKey:读取一个键(肯嗖瑞德K)
pai
1.a,c,d
2.
int a =0;
bool b = (a==0)&&(a<1);
console.writeLine(b);
3.a,c,d
加密解密题
int number = Convert.ToInt32(Console.ReadLine());
int qian = (number / 1000) % 10;
int shi = (number / 10) % 10;
Console.WriteLine(qian+"和"+shi);
Console.WriteLine("" + qian + shi);
int the = Convert.ToInt32(""+qian+shi);
Console.WriteLine((char)the);
数学与英语
int shuxue = Convert.ToInt32(Console.ReadLine());
int yingyu = Convert.ToInt32(Console.ReadLine());
bool a = (shuxue>=90)&&(yingyu>=90);
Console.WriteLine(a);
1.2 4
2.4 7 16 16 12
int整数类型
double小数类型
char字符类型
1.3 6
2.3
3.
Console.WriteLine("*");
Console.WriteLine("**");
Console.WriteLine("***");
Console.WriteLine("****");
Console.WriteLine("*");
Console.WriteLine("*");
Console.WriteLine("*");
4.
Console.WriteLine(" *");
Console.WriteLine(" ***");
Console.WriteLine(" *****");
Console.WriteLine("*******");
Console.WriteLine(" *");
Console.WriteLine(" *");
Console.WriteLine(" *");
5.d
6.
Console.Write("Siki说:\"what is ");
Console.Write("\\n\"");
visualstudio.microsoft.com
变量使用Camel(驼峰命名法)
方法和类使用Pascal命名规范
2
“”前面加个@“”里面转义字符失效
字符串只能放在同一行声明
“”内""号代表”