|
||||||
| C and C++ C and C++ forum for discussing all forms of C except for C#. These languages are powerful low level languages used for creating Operating Systems, Device Drivers, compilers and much more. |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
| Sponsored Links |
|
|
|
|||||
|
You've to use the namespace, std.
You can use it by using, using namespace ___ or by using std and the scope operators. Code:
#include <iostream>
#include <vector>
int main()
{
std::vector<int> vec(3, 100);
std::cout << "Vector size is " << vec.size() << std::endl;
vec.push_back(7);
vec.push_back(8);
vec.push_back(9);
std::cout << "\t3 elements added" << std::endl;
std::cout << "Vector size is now " << vec.size() << std::endl;
std::cout << "\tFirst element is " << vec.front() << std::endl;
std::cout << "\tSecond element is " << vec.at(1) << std::endl;
std::cout << "\tLast element is " << vec.back() << std::endl;
system("PAUSE");
return 0;
}
Code:
using namespace std; |
![]() |
| 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 |
| A challenge for anyone who wants one : ) | digiology | General Programming | 1 | 03-03-2007 04:14 PM |
| Link buy goes wrong | Kaabi | Search Engine Optimization | 5 | 01-08-2007 08:15 AM |
| What is wrong with this code convertion ? | Jophry | C and C++ | 1 | 01-04-2007 01:10 PM |
| Whats wrong with my query!!! | Saint | Database & Database Programming | 2 | 10-22-2006 07:09 PM |
| Something wrong... | MrDiaz | The Lounge | 5 | 07-15-2006 01:57 PM |
| WingedPanther | ........ | 2753.6 |
| Xav | ........ | 2704 |
| Brandon W | ........ | 1702.32 |
| John | ........ | 1207.73 |
| marwex89 | ........ | 1175.24 |
| morefood2001 | ........ | 966.05 |
| dcs | ........ | 655.75 |
| Steve.L | ........ | 475.59 |
| orjan | ........ | 418.58 |
| Aereshaa | ........ | 383.54 |