-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvector3.cpp
More file actions
37 lines (26 loc) · 846 Bytes
/
vector3.cpp
File metadata and controls
37 lines (26 loc) · 846 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
// Example program
#include <iostream>
#include <string>
#include <vector>
using std::vector;
using std::cout;
void printVector(vector<float> vIn){//printing the contents of vIns
//TODO: Complete the function
vector<float>::iterator it; //make a iterator
for (it=vIn.begin(); it!=vIn.end(); ++it){
cout<<*it<<" ";
}
}
int main (){
vector<float>vFloat;
//TODO: create a vector of floats
std::cout<<"vFloat has "<<vFloat.size()<<" elements\n";
std::cout<<"\n\nAdding 10 elements to the vector\n";
vFloat.assign(10, 8.8);
//TODO: assign the value 8.8 to 10 elements of the vector
std::cout<<"vFloat has "<<vFloat.size()<<" elements\n";
printVector(vFloat);
//TODO: Complete the Print function in main.hpp
// Call the function here to print out each element of vFloat
return 0;
}