20251221_134838 數組的增刪改查
數組的遍歷
把數組中的所有數值都取出來
#include iostream
using namespace std;
int main(){
int nums[10] = {22,66,45,92};
int n = 4;
for(int i=0;in;i++){
coutnums[i]endl;
}
}
20251121_160633 求數的平方根結果保留兩位小數
#include iostream
#include cmath
#include iomanip
using namespace std;
int main(){
int n = 38;
double r = sqrt(n);
coutfixedsetprecision(2)rendl;
}
20251114_220531 數組的中部刪除
#include iostream
using namespace std;
int main(){
// 定義一個數組
int nums[100];
// 給數組賦初始值
int len = 10;
int temp = 1000;
// 讓數組中有len個成員
for(int i=0;ilen;i++){
//