-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.cpp
More file actions
55 lines (54 loc) · 969 Bytes
/
Copy pathtest.cpp
File metadata and controls
55 lines (54 loc) · 969 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include <iostream>
#include "myvector.h"
/*
void test1()
{
cout << "test1 从键盘输入10个整数,产生顺序表"<<endl;
myvector<int> a;
for (int i = 0; i < 10; i++) {
int n;
cin >> n;
a.push_back(n);
}
for (auto m : a) {
cout << m<<" ";
}
cout << endl;
}
void test2()
{
cout << "test2 从键盘输入1个整数,在顺序表中查找该结点的位置。若找到,输出结点的位置;若找不到,则显示“找不到”。"<<endl;
myvector<int> a;
for (int i = 0; i < 10; i++) {
a.push_back(i);
}
int n;
cin >> n;
if (a.find(n) != -1) {
cout <<a.find(n)<<" "<< "找到了" << endl;
}
else {
cout << "没找到" << endl;
}
}
void test3() {
cout << "test3 从键盘输入2个整数,一个表示欲插入的位置i,另一个表示欲插入的数值x," << endl;
myvector<int> a;
for (int i = 0; i < 10; i++) {
a.push_back(i);
}
int i,n;
cin >> i>>n;
auto pos = a.begin() + i;
a.insert(pos,n);
for (auto m : a) {
cout << m << " ";
}
cout << endl;
}
int main() {
//test1();
//test2();
test3();
}
*/