-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added two programs that utilze vectors.
- Loading branch information
1 parent
1eac3c4
commit 05713db
Showing
3 changed files
with
32 additions
and
1 deletion.
There are no files selected for viewing
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
23 changes: 23 additions & 0 deletions
23
...7.12 If You Plan to Continue in Computer Science: Introduction to the STL vector/7-25.cpp
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
//***************************************************************** | ||
// This program demonsrates the range-based for loop with a vector. | ||
// | ||
// By: Jesus Hilario Hernandez | ||
// Last Updated: November 12, 2016; | ||
//***************************************************************** | ||
#include <iostream> | ||
#include <vector> | ||
using namespace std; | ||
|
||
int main() | ||
{ | ||
// Define and initialize a vector. | ||
vector<int> numbers {10, 20, 30, 40, 50 }; | ||
|
||
// Display the vector elements. | ||
for (int val : numbers) | ||
{ | ||
cout << val << endl; | ||
} | ||
|
||
return 0; | ||
} |
8 changes: 8 additions & 0 deletions
8
.../7.12 If You Plan to Continue in Computer Science: Introduction to the STL vector/7-25.sh
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Jesuss-iMac:7.12 If You Plan to Continue in Computer Science: Introduction to the STL vector hernandezfamily$ g++ -std=c++11 7-25.cpp | ||
Jesuss-iMac:7.12 If You Plan to Continue in Computer Science: Introduction to the STL vector hernandezfamily$ ./a.out | ||
10 | ||
20 | ||
30 | ||
40 | ||
50 | ||
Jesuss-iMac:7.12 If You Plan to Continue in Computer Science: Introduction to the STL vector hernandezfamily$ |