首页 技术 正文
技术 2022年11月18日
0 收藏 420 点赞 2,428 浏览 1859 个字

代码如下:

namespace ConsoleApplication1
{
class @class
{
static void Main_1(string[] args) //输出用户输入的内容
{
string admin = "";
while (true)
{
Console.WriteLine("请输入您想显示的内容5");
admin = Console.ReadLine();
if(admin == "")
{
Console.WriteLine("您未输入内容,即将关闭");
Console.ReadLine();
return; }
Console.WriteLine("您输入的内容是" + admin);
Console.ReadLine();
}
} #region bool
public static void @static(bool @bool) //@bool作为逻辑变量名
{
if (@bool)
System.Console.WriteLine("true");
else
System.Console.WriteLine("false");
}
static void Main_2()
{
@class.@static(true);
Console.ReadLine();
}
#endregion static void Main_3() // short的长度范围
{
short x = 32766;
x++;
Console.WriteLine(x);
x++;
Console.WriteLine(x);
Console.ReadLine();
} static void Main_4() //bool
{
bool a = true;
int i = 20;
bool b = i > 0 && i < 10;
Console.WriteLine("a值为:"+a+"\tb值为:"+b);
Console.ReadLine();
} static void Main_5() //转义符(\n换行\t(水平制表字符)向右8个字符)
{
Console.WriteLine("\n\tHello\n\tWorld!");
Console.ReadLine();
} static void Main_6() //操作符
{
int x = 5, y = 10, z;
x++; //后缀一元操作符
--x; //前缀一元操作符
z = x + y; //二元操作符
y = x > 10 ? 0:1; //三元操作符
System.Console.WriteLine(y); //输出三元操作符判断结果
Console.ReadLine();
} #region ++运算符
static void F(int x,int y,int z)
{
Console.WriteLine("x={0},y={1},z={2}",x,y,z);
}
static void Main_7()
{
int i = 1;
F(i++,i++,i++); //使用"++"运算符实现递加运算
Console.ReadLine();
}
#endregion static void Main_8() //不同操作符及不同数据类型得到不同的计算结果(例:5/2=2 but 5.0/2=2.5)
{
Console.WriteLine(5/3);
Console.WriteLine(4/3);
Console.WriteLine((5/3)==(4/3));
Console.WriteLine(5.0/3);
Console.WriteLine(4.0/3);
Console.WriteLine((5.0/3)==(4.0/3));
Console.ReadLine();
} static void Main_9() //右结合性
{
/*
* 由于赋值运算符是右结合性的,所以表达式a+=a-=a*=a等价于a+=(a-=(a*=a)),该表达式的求解过程为:
* 首先计算 a*=a,则a=144。
* 其次计算a-=144,则a=12-144=-132。
* 最后计算a+=-132,则a=12+(-132)=-120。
*/
int a = 12;
a += a -= a *= a;
Console.WriteLine(a);
Console.ReadLine();
} static void Main_10()
{
int intValue = 16; //定义整型变量
long longValue = intValue; //定义长整型,用于时间隐式转换(不丢失信息)
Console.WriteLine("intValue={0},longValue={1}",intValue,longValue);//显示转换后的值
Console.ReadLine();
} static void Main()
{ }
}
}
相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:8,954
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,479
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,291
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,108
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,740
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,774