I saw this example while i am searching about vectors..
vector<double> student_marks;
// no size specified: vector contains
// no elements
int num_students;
cout << "Number of students: " << flush;
cin >> num_students;
student_marks.resize (num_students);
for (vector<double>::size_type i = 0; i < num_students; i++)
{
cout << "Enter marks for student #" << i+1
<< ": " << flush;
cin >> student_marks[i];
}
cant we use
for (int i = 0; i < num_students; i++)
instead of
for (vector<double>::size_type i = 0; i < num_students; i++)
thanks in advance