Last active
November 7, 2018 22:54
-
-
Save knapply/da952ed9a5cc2a04d4aa72e653b5a649 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> // std::cout, std::endl | |
#include <vector> // std::vector | |
using std::cout; | |
using std::endl; | |
using std::vector; | |
int length(vector<double> &x) { | |
int out = 0; | |
for (auto it = begin(x); it != end(x); ++it) { | |
out++; | |
} | |
return out; | |
} | |
int main() { | |
vector<double> v{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 }; | |
int result = length(v); | |
cout << "length: " << result << endl; | |
return 0; | |
} | |
//> length: 20 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment