2代码规范

This commit is contained in:
iridiumR 2021-10-03 11:21:32 +08:00
parent d4ad5301b5
commit b1e453a396

15
ex2.cpp
View file

@ -3,11 +3,9 @@
#include <stdlib.h>
#include <time.h>
class Vec
{
private:
int *v;
int LEN;
int USED;
@ -17,7 +15,6 @@ class Vec
void shrink();
public:
Vec(int len);
int get(int a);
@ -39,7 +36,6 @@ class Vec
int getused();
};
Vec::Vec(int len)
{
LEN = len * 2;
@ -159,10 +155,6 @@ void Vec::printall()
printf("%d\n", v[i]);
}
int main()
{
srand(time(NULL));
@ -171,14 +163,12 @@ int main()
int temp[10] = {0};
int flag;
printf("初始化,输出数组\n");
v.printall();
while (1)
{
printf("选择操作:\n1.插入\n2.删除\n3.查找\n");
printf("Ñ¡Ôñ²Ù×÷:1.²åÈë 2.ɾ³ý 3.²éÕÒ\n");
scanf("%d", &flag);
switch (flag)
@ -209,9 +199,6 @@ int main()
printf("返回菜单\n");
}
flag = 0;
}
return 0;