-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathb_vector.cpp
53 lines (45 loc) · 887 Bytes
/
b_vector.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
#include<bits/stdc++.h>
using namespace std;
// void print(vector<int>&vec1)
// {
// for(int i = 0 ; i<vec1.size();i++)
// cout<<vec1[i];
// vec1.push_back(10);
// }
// int main()
// {
// int n;
// cin>>n;
// vector<int>vec;
// for(int i = 0 ; i<n;i++)
// {
// int k;
// cin>>k;
// vec.push_back(k);
// }
// print(vec);
// cout<<endl;
// print(vec);
// for(int i = 0 ; i<vec.size();i++)
// {
// cout<<vec[i];
// }
void print(vector<string> &vec)
{
for(int i = 0 ; i<vec.size();i++)
cout<<i+1<<". "<<vec.at(i)<<endl;
}
int main()
{
int n;
cout<<"Enter the number of students in class: ";
cin>>n;
vector<string>vec;
for(int i = 0 ; i<n;i++)
{
string s;
cin>>s;
vec.push_back(s);
}
print(vec);
}