正在加载图片...
顺序存储结构 DS动态数组 #include <iostream.h> For(I=0; I<6; I++) #include<stdlib.h> 算 Void main(oid) Temp[I=I+1; 机{ cout <<I="<<I<< int I temp: “temp=<<temp<< M const int MaxSize=100;end 院 } 自 教 temp=new int[MaxSizel; deleteL temp: 研 室申请和释放由用户通过调用new和 delete运算符完成 lixuejun@swust.edu.cnlixuejun@swust.edu.cn 顺序存储结构 #include<iostream.h> #include<stdlib.h> Void main(void) { int I,*temp; const int MaxSize=100; temp=new int[MaxSize]; For(I=0;I<6;I++) { Temp[I] = I+1; cout<<“I=”<<I<< “temp[i]=“<<temp[i]<< endl”; } delete[ ]temp; } 计 算 机 学 院 信 息 教 研 室 DS 动态数组 申请和释放由用户通过调用new和delete运算符完成
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有