|
||||||
| C Tutorials All C Tutorials and Code |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
|
||||
|
Re: On Learning the STL: Chapter 1 (Vectors) - Part 1
Very nice. +rep.
__________________
CodeCall Blog | CodeCall Wiki | Shareware Programming is a branch of mathematics. My CodeCall Blog | My Personal Blog |
|
||||
|
Re: On Learning the STL: Chapter 1 (Vectors) - Part 1
Vectors are powerful, nicely written. +rep
__________________
Questions and Answers | Online News and Social Bookmarking | Code and Text Collaboration General Chat Forum |
|
||||
|
Re: On Learning the STL: Chapter 1 (Vectors) - Part 1
Very nice.
Quote:
Regarding your code to output the vector. You can also use the [] operator to output items. Since the vector is a direct access container this code below would also work. Code:
for (int i=0;i<v.size();i++) {
cout << v[i] << " ";
}
cout << endl;
|
|
||||
|
Re: On Learning the STL: Chapter 1 (Vectors) - Part 1
@chili5:
True, there is an overhead when using the erase method, however for the size of an array I made it was negligible. The optimal way to do this would probably be to simply iterate through the vector and cout the value if (*myIter % 2) == 0 returns false. ![]() Quote:
![]()
__________________
On Hiatus... |
|
||||
|
Re: On Learning the STL: Chapter 1 (Vectors) - Part 1
Code:
i < v.size() _____________________ >> Warning: Comparison between signed and unsigned integer expressions.
__________________
On Hiatus... |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Validation - Part 2 - Client-Side | Kernel | News | 0 | 04-28-2009 02:40 AM |
| Using ExportProvider to customize container behavior Part I | Kernel | News | 0 | 12-25-2008 08:11 AM |
| Learning On A Project | Kernel | News | 0 | 10-10-2008 07:10 AM |
| ROBOT ASSEMBLY-- C language | hummer350 | C and C++ | 3 | 07-31-2008 11:03 PM |
| Adventures in F# - F# 101 Part 9 (Control Flow) | Kernel | News | 0 | 05-05-2008 08:43 AM |
All times are GMT -5. The time now is 10:29 AM.
Amrosama.cc
Arekbulski.cc
Debtboy.cc
Guest.cc
Jaan.cc
James.cc
Mathx.cc
Tsz.cc
Vswe.cc