No 1:
I noticed in a previous post that there was a debate about the use of cout and std::cout. I feel like I partially understand this and sense that it has something to do with <iostream.h> vs <iostream> and 'including namespace std' and the ANSI C++ standards.
Does this make sense and is there any chance of a brief explanation of this.... becuase in the textbooks I'm using, they all seem to refer to cout rather than std::cout.
No 2:
I'm trying to write a program to do simple statistics (mean, standard deviation). At the moment I'm using arrays to store the data set. I've not had a problem as long as I am able to say how many numbers there are in the data set, e.g
But what should I do if I don't know how many should be in the data set (i.e. what happens when I don't know what 'n' is before I input the data? I'm sure this isn't a new question. Is using <fstream> the solution?Code:int n; cout << "How many numbers in the data set? "; cin >> n; double dataSet[n]; //But what to do if I don't know what 'n' is? for (int counter = 0; counter !=n; counter++) { cout << "\nNumber " << (counter +1) << ": "; cin >> dataSet[counter]; } etc