Hi..
I am trying doing this exercise.Which is require a program that could ask the user how many integer he/she want to enter,and allow him/her entering them thus lastly display them all back.
i could just simply doing it by using an array,but this time i wanna use a vector to this,but it seems that my codes did not work.So i hope somebody could correct it for me..
This is what i have done :
int main() {
vector<double> data;
int count;
cout<<"How many numbers you want to enter? "<<endl;
cin>>count;
cout<<"Please enter values : "<<endl;
double input;
for(int i=0; i<count; i++)
{
data.push_back(input);
}
cout<<endl;
for(int i=0; i<data.size(); i++)
{
cout<<data[i]<<" ";
}
system ("pause");
return 0;
and one more thing,could somebody explain more about differences using .push_back and cin>> in vector??
TQ :)