The program's output: 0000000000;
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
#include <iostream>
#include <vector>
using namespace std;
int main()
{
vector <float> v(10);
float num;
for(int i = 0; i < 10; i++)
{
cout << "Insert a number: " <<endl;
cin >> num;
v.push_back(num);
}
for(int i = 0; i < 10; i++)
{
cout << v[i] <<endl;
}
system("pause");
}
|
Last edited on
vector <float> v(10);
should be vector <float> v;
Do what Yanson said or change line 14 to v[i] = num;
thanks, problem solved =)