Help!A simple question...
hi,i am just a novice to cpp programming.
here is a simple program to store 25 floating-numbers using a vector and then output all the elements in the vector.
when i excute it , some problem arise and i don't know why
Could anyone tell me why???thx~~~
Code:
// This program asks user to input 25 floating numbers and then output them
#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main(){
vector<float> v;
int i=0;
while(i<3){
cin >> v[i] ;
i++;
}
cout << "\n";
cout << v[0] << endl;
for(int j=0;j<v.size();j++){
cout << v[j] << endl;
}
return 0;
}//