#include <iomanip>
#include <iostream>
#include <vector>
#include <math.h>
using std::cin;
using std::cout;
using std::endl;
using std::vector;
vector<int> source;
vector<double> square;
typedef vector<int>::size_type vi_t ;
int main()
{
for(int i = 0; i < 1000 ; i++)
{
source.push_back(i);
square.push_back(sqrt(i));
}
for(vi_t i = 0; i < 1000 ; i++)
cout << source[i] <<std::setw(20) << square[i] << endl;
}
It supposed to display from vector[0] to vector[999] .total 1000 elements per column .
but actually it only displays from vector[704] to vector[999]
What's wrong with my code ? There is no compile error either ...
I'm betting that your console isn't storing all of the history (I'm guessing it stores ~300 lines). Try piping the output to a file and looking at it that way, or waiting every 100 or so lines.
You can't put 2 liters of water in a 1 liter bottle. You can't display a thousand lines in a screen that's 25 lines tall. If you need to display more at once then you can't use the console. It's as simple as that.