-
class:这个关键词的用途是声明类。 namespace:声明命名空间。 using:导入命名空间。using System.Text作用是导入System.Text命名空间的类 static(静态的)、void(无返回值)、string(字符串类) 如果没有Main()方法程序就无法启动 C#语言是严格区分大小写的查看全部
-
查找算法,主要有 2 个步骤: 1、使用循环访问数组中的每一个元素 2、在循环体中设置筛选条件,打印符合条件的元素查看全部
-
但是,2个整数相除,结果仅保留整数部分,小数部分会被舍去查看全部
-
6.29查看全部
-
GetLongLength(0)返回数组中的一位数组的个数查看全部
-
bool has7=false; foreach (int x in num) if(x%7==0) { has7=true; break; }查看全部
-
for 循环使我们可以通过索引访问数组元素;而 foreach 循环则可以不依赖索引而读取每一个数组元素。查看全部
-
Consloe.Wtite("") ;查看全部
-
但是,2个整数相除,结果仅保留整数部分,小数部分会被舍去。 Console.WriteLine(5/10);//输出0 为什么要这样设计?查看全部
-
数组的一个属性 Length , Length 能够返回数组的长度,利用它和数组元素的索引,我们可以循环访问每一元素。查看全部
-
数组的声明和初始化语法如下: 数据类型[ ] 数组名 = new 数据类型[长度];查看全部
-
数据类型[ ] 数组名 = new 数据类型[长度];查看全部
-
using System; using System.Collections.Generic; using System.Text; namespace Test { class Program { static void Main(string[] args) { for(int x = 1; x <= 7; x++) { for(int y = 1; y <= 7; y++) if((x==y)(x+y==8)) { Console.Write("O"); } else { Console.Write("."); } Console.WriteLine( ); }//请完善代码 } } }查看全部
-
当程序执行到到 continue; 的时候,会立即停止本次循环体,直接进入下一次循环。查看全部
-
static void Main(string[] args) { string[] name={"景珍","林慧洋","成蓉","洪南昌","龙玉民","单江开","田武山","王三明"}; int[] score={90,65,88,70,46,81,100,68}; int sum=0; double avg=0; for(int i=0;i<score.Length;i++) { sum+=score[i]; } avg=sum/score.Length; Console.WriteLine("平均分是"+avg+","+"高于平均分的有:"); for(int i=0;i<score.Length;i++) { if(score[i]>avg) Console.Write(name[i]); }查看全部
举报
0/150
提交
取消