为了账号安全,请及时绑定邮箱和手机立即绑定
慕课网数字资源数据库体验端
C#开发轻松入门_学习笔记_慕课网
为了账号安全,请及时绑定邮箱和手机立即绑定

C#开发轻松入门

绿豆开门 其它
难度入门
时长 4小时43分
  • using System; using System.Collections.Generic; using System.Text; namespace projGetMaxScore { class Program { static void Main(string[] args) { string[,] score = new string[,] { { "吴松", "89" }, { "钱东宇", "90" }, { "伏晨", "98" }, { "陈陆", "56" }, { "周蕊", "60" }, { "林日鹏", "9" }, { "何昆", "93" }, { "关欣", "85" } }; int f=0,tmp=0; for(int i=0;i<score.GetLongLength(0);i++) { if(tmp < int.Parse(score[i,1])) { f = i; tmp = int.Parse(score[i,1]); } } Console.WriteLine("分数最高的是{0},分数是{1}",score[f,0],score[f,1]); } } }
    查看全部
    0 采集 收起 来源:练习题目

    2018-03-22

  • using System; using System.Collections.Generic; using System.Text; namespace projGetMaxScore { class Program { static void Main(string[] args) { int j=0; string []name=new string[8]{"吴松","钱东宇","伏晨","陈陆","周蕊","林日鹏","何昆","关欣"}; int []score=new int[8]{89,90,98,56,60,91,93,85}; for(int i=1;i<8;i++){ if(score[j]<score[i]){ j=i; } } Console.WriteLine("分数最高的是"+name[j]+","+"分数是"+score[j]); } } }
    查看全部
    0 采集 收起 来源:练习题目

    2018-03-22

  • using System; using System.Collections.Generic; using System.Text; namespace projGetMaxScore { class Program { static void Main(string[] args) { string[,] info = new string[8, 2] { { "吴松", "89" }, { "钱东宇", "90" }, { "伏晨", "98" }, { "陈陆", "56" }, { "周蕊", "60" }, { "林日鹏", "9" }, { "何昆", "93" }, { "关欣", "85" } }; string name="",score="0"; for(int i=0;i<8;i++) { if(String.Compare(info[i,1],score)>0) { score = info[i,1]; //判断成绩 name = info[i,0]; // 判断名字 } } Console.WriteLine("分数最高的是"+name+",分数是"+score); } } }
    查看全部
    0 采集 收起 来源:练习题目

    2018-03-22

  • ①括号。学数学的时候我们就知道,要先计算括号里面的内容。C#语言也是一样,如果有多层括号,要从里向外计算。括号优先级最高。 ②一元运算符。有些运算符两边有2个操作数,比如2+3、6%5等等,这些叫做二元运算符。只有一个操作数的叫做一元运算符,它们的优先级高于二元运算符。一元运算符包括:++(自加) 、 --(自减) 、 !(逻辑非)。 ③*(乘)、/(除)、%(取余)。 ④+(加)、-(减)。 ⑤>(大于)、<(小于)、>=(大于等于)、<=(小于等于)。 ⑥==(等于)、!=(不等于)。 ⑦&&(逻辑与)。 ⑧||(逻辑或)。 ⑨赋值运算符。包括:=、+=、-=、*=、/=、%=。 另外,还需要注意一点:优先级相同的运算符从左向右计算(赋值运算符相反)。
    查看全部
  • using System; using System.Collections.Generic; using System.Text; namespace Test { class Program { static void Main(string[] args) { char[,] ch = { {'我','是','软'},{'件','工','程'},{'师','啦','!'}}; Console.WriteLine("{0}{1}{2}",ch[1,1],ch[1,2],ch[2,0]); //对应{0数组为'我''是''软'}'我'的下标为0,'是'的下标为1 . 依次类推,1,2数组类容下标。 } } }
    查看全部
  • using System; using System.Collections.Generic; using System.Text; namespace Test { class Program { static void Main(string[] args) { //声明整型数组,保存一组整数 int[] num = new int[] { 3,34,43,2,11,19,30,55,20}; bool hassb = false;//默认没有 for(int i=0;i<num.Length;i++) { if(num[i]%7==0 ) { hassb = true; //有7倍数的记录 break; } } Console.Write(hassb?"有7的整倍数":"没有7的整倍数") ; } } }
    查看全部
    0 采集 收起 来源:编程练习

    2018-03-22

  • using System; using System.Collections.Generic; using System.Text; namespace Test { class Program { static void Main(string[] args) { string[] t =new string[]{"C","Sh","a","rp"}; foreach(string j in t)//遍历字符串数组t 迭代变量 j { Console.Write(j); } } } }
    查看全部
  • using System; using System.Collections.Generic; using System.Text; namespace Test { class Program { static void Main(string[] args) { string[] t =new string[]{"C","Sh","a","rp"}; foreach(string j in t)//遍历字符串数组t { Console.Write(j); } } } }
    查看全部
  • if...else 条件结构中,如果某个分支只包含一条命令,那么是可以省略大括号{}的。
    查看全部
  • 数据类型[ ] 数组名 = new 数据类型[长度];
    查看全部
  • 前面学习 switch 结构时,我们曾经遇到过 break 关键字, break 在 switch 结构的作用是“跳出 switch 结构”。 break 关键字还可以用在循环中,作用是“结束循环”。
    查看全部
  • 循环中可以应用 continue 关键字中止一次循环,直接进入下一次
    查看全部
  • do...while 循环第一次执行循环体是没有经过条件判断的,也就是说会无条件的执行一次循环体,此后的逻辑 顺序就与while循环相同了——先判断条件,条件为true再执行循环体一次。
    查看全部
  • switch 中的(变量)只能是3种类型:整型(如 int )、字符型( char )、字符串类型( string )。
    查看全部
    0 采集 收起 来源:C#的switch结构

    2017-10-18

  • if...else 之外,C#中还有一种 switch 条件结构,可以用来对变量进行多个分支的等值判断。语法如下: (变量)与每一个 case 后面的常量进行等值比较,如果相等,就执行对应的分支。执行分支以后, break 关键字会使 switch 结构中止,不会再判断后面的常量。如果变量与所有的常量都不相同,则执行 default 后面的分支。
    查看全部
    0 采集 收起 来源:C#的switch结构

    2017-10-18

举报

0/150
提交
取消
课程须知
本课程是C#基础课程,热烈欢迎各位小伙伴拍砖吐槽!!
老师告诉你能学到什么?
1、C#的基本概念 2、Visual Studio的使用技巧 3、C#的语法和程序逻辑
友情提示:

您好,此课程属于迁移课程,您已购买该课程,无需重复购买,感谢您对慕课网的支持!