陣列進行增 刪 查 改

2021-06-13 14:40:48 字數 1878 閱讀 5442

class program

return num;

}set

}/// 程式入口處

/// 程式入口處

///

///

static void main(string args)

console.writeline("請輸入刪除的數");

shu = int.parse(console.readline());

minusarray(shu);

break;

case "4":

if (cun() == false)

console.writeline("請輸入要修改的數");

shu = int.parse(console.readline());

console.writeline("請輸入修改值");

reshu = int.parse(console.readline());

amendarray(shu, reshu);

break;

case "5":

if (cun() == false)

console.writeline("請輸入要查詢的數");

shu = int.parse(console.readline());

findarray(shu);

break;

default:

console.writeline("輸入錯誤!!");

break;

}} while (tian != "6");

}/// 新增

/// 新增

///

/// 新增的數

public static void addarray(int shu)

}if (num == null)

else

newnum[newnum.length - 1] = shu;

num = newnum;

console.writeline("新增成功!!");}}

/// 刪除

/// 刪除

///

///

public static void minusarray(int shu)

}if (index < 0)

for (int i = 0; i < num.length; i++)

else}}

num = newnum;

if (index >= 0)

}/// 修改

/// 修改

///

///

public static void amendarray(int shu, int reshu)

}int index2 = -1;

if (index >= 0)

}if (index2 >= 0)

else

}else

}/// 查詢陣列是否此資料

/// 查詢陣列是否此資料

///

///

public static void findarray(int shu)

}if (index > 0)

", shu);

}else

}/// 顯示陣列清單

/// 顯示陣列清單

///

public static void listarray()

else}}

/// 判斷陣列是否為空或者陣列長度為0

/// 判斷陣列是否為空或者陣列長度為0

///

///

public static bool cun()

return bl;

}}

C 陣列的增刪查改

陣列的增刪查改 using system using system.collections.generic using system.linq using system.text using system.threading.tasks using system.collections namesp...

MongoDB增刪查改

mongodb沒有建立資料庫的命令,但是你可以先執行use db name來進行一些操作,如db.createcollection db table 這樣就可以建立乙個db name的資料庫了。以下語句其實都不用加引號 insert方法 insert obj db.test.insert write...

sed 增刪查改

對每行處理,文字替換 1.替換 s命令 sed s jcdd ganji g file 把檔案 file 中出現jcdd 的換出ganji.g標誌在整行範圍內把jcdd都替換為ganji。如果沒有g 標記,則只有每行第乙個匹配的jcdd被替換成ganji。g換出 ng代表 第n處開始出現的替換 se...