亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

C#開發輕松入門

難度入門
時長 4小時43分
學習人數
綜合評分9.40
833人評價 查看評價
9.5 內容實用
9.5 簡潔易懂
9.2 邏輯清晰
  • 邏輯非 !? 取反,如果結果真 返回假,如果結果假 返回真

    邏輯與 && 兩布爾表達式結果同時為True時結果為True,判斷兩個布爾類型表達式有一個為False,結果就為False

    邏輯或 || 只要兩個表達式有一個位True,結果就為True,兩個表達式同時為False時返回結果才為False

    查看全部
  • ()不會打印3

    A Console.Write((int)3.6);浮點型強制轉換整形去掉小數點 結果3


    B Console.Write((double)3.6); 浮點型3.6

    C Console.Write((int)3); 整形3

    D Console.Write((double)3); 輸出浮點型3

    查看全部
    0 采集 收起 來源:練習題

    2024-03-06

  • 試了試

    目前還不會在同一個文件里,創建新的類

    不然,就可以

    創建 學生類 class student

    包含 (屬性) 姓名和分數? string name;int score;

    同時包含 (方法) set姓名和set分數 以及 get姓名和get分數

    ?????? ?void????setName()

    ????????void????setScore()

    ????????string? ? getName()

    ????????int? ? getName()

    創建包含8個學生的 學生數組????student[] ss=new student[8];

    給每個學生 錄入 姓名和分數

    ????????ss[0].setName("吳松");

    ????????ss[0].setScore(89);

    然后 比較學生的分數得到最大值和序列號

    根據序列號可以get姓名



    記錄,如果以后還記得 嘗試一下

    查看全部
    0 采集 收起 來源:練習題目

    2024-02-29

  • using?System;
    using?System.Collections.Generic;
    using?System.Text;
    
    namespace?projAboveAvg
    {
    ????class?Program
    ????{
    ????????static?void?Main(string[]?args)
    ????????{
    ????????????string[]?names?=?new?string[]?{"景珍","林慧洋","成蓉","洪南昌","龍玉民","單江開","田武山","王三明"};
    ????????????int[]?score?=?new?int[]?{90,65,88,70,46,81,100,68};
    ????????????int?sum?=?0,avg;
    ????????????foreach(int?i?in?score){
    ????????????????sum?+=?i;
    ????????????}
    ????????????avg?=?sum?/?score.Length;
    ????????????Console.Write("平均分是"+?avg?+",高于平均分的有:");
    ????????????for(int?i?=?0;i<score.Length;i++){
    ????????????????if(score[i]?>?avg){
    ????????????????????Console.Write(names[i]+"?");
    ????????????????}
    ????????????}
    ????????}
    ????}
    }
    查看全部
    0 采集 收起 來源:最終項目

    2024-01-14

  • using?System;
    using?System.Collections.Generic;
    using?System.Text;
    
    namespace?projGetMaxScore
    {
    ????class?Program
    ????{
    ????????static?void?Main(string[]?args)
    ????????{
    ????????????string[,]?stu?=?new?string[8,?2]?{?{?"吳松",?"89"},?{?"錢東宇","90"},?{"伏晨","98"?},?{"陳陸","56"?},?{"周蓉","60"?},?{"林日鵬","91"?},{"何昆","93"?},?{"關欣","85"?}?}?;
    ??????????//?查找分數最高的同學
    ????????????int?maxScore?=?int.MinValue;
    ????????????string?topStudent?=?"";
    
    ????????????//?獲取數組的行數和列數
    ????????????int?rows?=?stu.GetLength(0);
    ????????????int?cols?=?stu.GetLength(1);
    
    ????????????//?遍歷數組
    ????????????for(int?i?=?0;i<rows;i++){
    ????????????????int?score?=?int.Parse(stu[i,1]);
    ????????????????if(score?>?maxScore){
    ????????????????????maxScore?=?score;
    ????????????????????topStudent?=?stu[i,0];
    ????????????????}
    ????????????}
    
    ????????????//?輸出分數最高的同學的姓名和分數
    ????????????Console.WriteLine($"分數最高的同學是{topStudent},分數是{maxScore}");
    ????}
    ????}
    }
    查看全部
    0 采集 收起 來源:練習題目

    2024-01-14

  • 在 C# 中,GetLength 和 Length 是數組的兩個不同的屬性,用于獲取數組的長度信息。它們之間的主要區別在于:

    Length 屬性:

    示例:

    csharpCopy codeint[] arr = new int[] { 1, 2, 3, 4, 5 };int length = arr.Length; // length 的值是 5

    Length 是數組的屬性,用于獲取數組的總元素個數。

    對于一維數組,Length 返回的是數組的總元素個數。

    對于多維數組,Length 返回的是數組的總元素個數,包括所有維度的元素個數的乘積。

    Length 是一個整數屬性。

    GetLength 方法:

    示例:

    csharpCopy codeint[,] matrix = new int[,] { { 1, 2 }, { 3, 4 }, { 5, 6 } };int rows = matrix.GetLength(0); ? ?// rows 的值是 3int columns = matrix.GetLength(1); // columns 的值是 2

    GetLength 是一個方法,用于獲取指定維度上的元素個數。

    GetLength 接受一個參數,表示維度的索引。

    對于一維數組,可以使用 GetLength(0) 來獲取數組的長度。

    對于多維數組,可以使用 GetLength(index) 來獲取指定維度的元素個數。

    總的來說,Length 用于獲取整個數組的元素個數,而 GetLength 用于獲取指定維度上的元素個數。

    查看全部
    0 采集 收起 來源:練習題目

    2024-01-14

  • 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};
    ????????????//請完善代碼,判斷數組中有沒有7的整倍數
    ????????????bool?has7?=?false;
    ????????????foreach(int?x?in?num){
    ????????????????if(x%7==0){
    ????????????????????has7?=?true;
    ????????????????????break;
    ????????????????}
    ????????????}
    ????????????if(has7){
    ????????????????????Console.Write("有7的整倍數");
    ????????????????}
    ????????????????else{
    ????????????????????Console.Write("沒有7的整倍數");
    ????????????????}
    ????????}
    ????}
    }
    查看全部
    0 采集 收起 來源:編程練習

    2024-01-14

  • 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"};
    ????????????//遍歷字符串數組t
    ????????????foreach(string?x?in?t)
    ????????????{
    ????????????????Console.Write(x);
    ????????????}
    ????????}
    ????}
    }
    查看全部
  • using?System;
    using?System.Collections.Generic;
    using?System.Text;
    
    namespace?Test
    {
    ????class?Program
    ????{
    ????????static?void?Main(string[]?args)
    ????????{
    ????????????//聲明整型數組,保存一組整數
    ????????????int[]?num?=?new?int[]?{?3,34,42,2,11,19,30,55,20};
    ????????????//請完善代碼,循環打印數組中的偶數
    ????????????for(int?i?=?0;i<num.Length;i++){
    ????????????????if(num[i]%2==0)
    ????????????????{
    ????????????????????Console.Write(num[i]+",");
    ????????????????}
    ????????????}
    
    ????????}
    ????}
    }
    查看全部
    0 采集 收起 來源:編程練習

    2024-01-14

  • using?System;
    using?System.Collections.Generic;
    using?System.Text;
    
    namespace?Test
    {
    ????class?Program
    ????{
    ????????static?void?Main(string[]?args)
    ????????{
    ???????????string[]?names?=?{"關羽","張飛","趙云","馬超","黃忠"};//請在這里完善代碼
    ???????????for(int?x=0;x<?names.Length;x++){
    ???????????????Console.Write(names[x]+",");
    ???????????}
    ????????}
    ????}
    }
    查看全部
    0 采集 收起 來源:編程練習

    2024-01-14

  • using System;

    using System.Collections.Generic;

    using System.Text;


    namespace Test

    {

    ? ? class Program

    ? ? {

    ? ? ? ? static void Main(string[] args)

    ? ? ? ? {

    ? ? ? ? ? ?string[] names = {"關羽","張飛","趙云","馬超","黃忠"};//請在這里完善代碼

    ? ? ? ? ? ?for(int x=0;x< names.Length;x++){

    ? ? ? ? ? ? ? ?Console.Write(names[x]+",");

    ? ? ? ? ? ?}

    ? ? ? ? }

    ? ? }

    }

    查看全部
    0 采集 收起 來源:編程練習

    2024-01-14

  • using?System;
    using?System.Collections.Generic;
    using?System.Text;
    
    namespace?Test
    {
    ????class?Program
    ????{
    ????????static?void?Main(string[]?args)
    ????????{
    ????????????//聲明“職位”數組,初始化為:"經理","項目主管","技術總監","財務主管"
    ????????????string[]?job?=?new?string[4]{"經理","項目主管","技術總監","財務主管"};
    ????????????for?(int?i?=?0;?i?<?job.Length?;?i++)
    ????????????{
    ????????????????Console.WriteLine(job[i]);//打印職位
    ????????????}
    ????????}
    ????}
    }
    查看全部
  • using?System;
    using?System.Collections.Generic;
    using?System.Text;
    
    namespace?Test
    {
    ????class?Program
    ????{
    ????????static?void?Main(string[]?args)
    ????????{
    ????????????int[]?age?=?new?int[4];????????;//聲明并初始化長度為4的整形數組
    ????????????//為數組元素賦值
    ????????????age[?0]?=?18;
    ????????????age[1?]?=?20;
    ????????????age[?2]?=?23;
    ????????????age[?3]?=?17;
    ????????????Console.WriteLine("四名同學的年齡是:{0}、{1}、{2}、{3}",
    ????????????????age[?0],age[?1],age[?2],age[?3]);
    ????????}
    ????}
    }
    查看全部
  • using?System;
    using?System.Collections.Generic;
    using?System.Text;
    
    namespace?Test
    {
    ????class?Program
    ????{
    ????????static?void?Main(string[]?args)
    ????????{
    ????????????int[]?age?=?new?int[4];????????;//聲明并初始化長度為4的整形數組
    ????????????//為數組元素賦值
    ????????????age[?0]?=?18;
    ????????????age[1?]?=?20;
    ????????????age[?2]?=?23;
    ????????????age[?3]?=?17;
    ????????????Console.WriteLine("四名同學的年齡是:{0}、{1}、{2}、{3}",
    ????????????????age[?0],age[?1],age[?2],age[?3]);
    ????????}
    ????}
    }
    查看全部
  • using System;

    using System.Collections.Generic;

    using System.Text;


    namespace Test

    {

    ? ? class Program

    ? ? {

    ? ? ? ? static void Main(string[] args)

    ? ? ? ? {

    ? ? ? ? ? ? //請完善代碼

    ? ? ? ? ? ? for(int y=1;y<=7;y++){

    ? ? ? ? ? ? ? ? for(int x=1;x<=7;x++){

    ? ? ? ? ? ? ? ? ? ? if(x==y||x+y==8)

    ? ? ? ? ? ? ? ? ? ? Console.Write("O");

    ? ? ? ? ? ? ? ? ? ? else{

    ? ? ? ? ? ? ? ? ? ? ? ? Console.Write(".");

    ? ? ? ? ? ? ? ? ? ? }

    ? ? ? ? ? ? ? ? }

    ? ? ? ? ? ? ? ? Console.WriteLine();

    ? ? ? ? ? ? }

    ? ? ? ? }

    ? ? }

    }

    查看全部
    0 采集 收起 來源:編程練習

    2024-01-14

舉報

0/150
提交
取消
課程須知
本課程是C#基礎課程,熱烈歡迎各位小伙伴拍磚吐槽??!
老師告訴你能學到什么?
1、C#的基本概念 2、Visual Studio的使用技巧 3、C#的語法和程序邏輯

微信掃碼,參與3人拼團

微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號

友情提示:

您好,此課程屬于遷移課程,您已購買該課程,無需重復購買,感謝您對慕課網的支持!