-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtemp.cc
More file actions
42 lines (32 loc) · 764 Bytes
/
temp.cc
File metadata and controls
42 lines (32 loc) · 764 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
#include <iostream>
#include <vector>
#include <string>
using namespace std;
void print_values(const vector<int> &);
int main(int argc, char const *argv[])
{
if (argc < 2)
{
cout << "Usage: " << argv[0] << " <nItems> <item1> <item2> <...> <itemn>" << endl;
return 1;
}
int count = stoi(argv[1]);
cout << "Count: " << count << endl;
vector<int> test;
count++;
for (unsigned i = 1; i <= count; i++)
{
int currentVal = stoi(argv[i]);
test.push_back(currentVal);
// cout << "Pushed back value " << currentVal << endl;
}
print_values(test);
return 0;
}
void print_values(const vector<int> & v)
{
for (int val : v)
{
cout << "Val: " << val << endl;
}
}