-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtestt.cpp
71 lines (58 loc) · 1.24 KB
/
testt.cpp
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
// testt.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
//
#include "pch.h"
#include <iostream>
#include<string>
#include<vector>
using namespace std;
int main()
{
int temp;
int i = 0;
vector<vector<int>> continuousSubs;
vector<vector<int>>::iterator taill;
vector<int> tempvec;
vector<int> test;
while (cin >> temp) {
test[i++] = temp;
}
for (size_t j = 0; j < test.size(); j++)
{
temp = test[j];
tempvec.push_back(temp);
if (j == 0) {
continuousSubs.push_back(tempvec);
continue;
}
for (taill = continuousSubs.end(); taill >= continuousSubs.end()-j-1;taill--) {
(*taill).push_back(temp);
}
continuousSubs.push_back(tempvec);
}
/*for (size_t i = 0; i < n; i++) {
cout << test[i];
}*/
}
//我要输入一个数组,但是数组不知道确切大小,比如我输入1 2 3 4然后按回车键却不能结束,怎样才能按回车键结束呢
//int main()
//{
// int arr[100];
// int temp;
// int count = 0;
// char c;
// while (((cin >> temp).get(c)))
// {
//
// arr[count] = temp;
// if (c == '\n')
// break;
// count++;
// if (count >= 100)
// break;
// }
// for (int i = 0; i <= count; i++)
// cout << arr[i];
// system("pause");
// return 0;
//
//}