This shows you the differences between two versions of the page.
— |
cs-142:student-vectors [2014/10/23 10:37] (current) kseppi created |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | <code cpp> | ||
+ | #include <iostream> | ||
+ | #include <vector> | ||
+ | #include <string> | ||
+ | using namespace std; | ||
+ | |||
+ | int main() { | ||
+ | |||
+ | vector<int> ids; | ||
+ | vector<string> names; | ||
+ | |||
+ | ids.push_back(1); | ||
+ | names.push_back("Nick"); | ||
+ | |||
+ | ids.push_back(2); | ||
+ | names.push_back("Connor"); | ||
+ | |||
+ | for (auto student : ids) { | ||
+ | cout << student << ", "; | ||
+ | } | ||
+ | cout << endl; | ||
+ | |||
+ | system("pause"); | ||
+ | return(0); | ||
+ | } | ||
+ | </code> |