Page 1 of 1

How use STL?

Posted: Wed Jul 19, 2006 10:24 am
by kapysh
Sorry for stupid question, but i donn't understand how rightly use STL in my c++ programs.
I wrote this:
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>

using namespace std;

int main()
{
int N,i,j,k,l,max;
vector<int> mas[40004];
...

and if says "Compilation Error".

Please help.

Posted: Wed Jul 19, 2006 10:35 am
by sumankar
0. Post in the right place. [Help On Languages -> C++]
1. What are you trying to do? Your code is declaring/defining an array of vectors (roughly a 2D array) of integers. Is that what you want? Or, is it that you want a 1D array in which case the following suffices:

Code: Select all

#include <vector>
int main() 
{
   std::vector<int> vInt;
   // manipulate the vector   
}
2. Use <cmath> instead of <math.h> if you want C math library functions.
3. Post the whole code: its not possible for us to deduce where and why you are hitting a CE.

Posted: Wed Jul 19, 2006 10:54 am
by kapysh
sorry, I don't list all topics