Your variable size
is declared as: float size;
You can’t use a floating point variable as the size of an array – it needs to be an integer value.
You could cast it to convert to an integer:
float *temp = new float[(int)size];
Your other problem is likely because you’re writing outside of the bounds of the array:
float *temp = new float[size]; //Getting input from the user for (int x = 1; x <= size; x++){ cout << "Enter temperature " << x << ": "; // cin >> temp[x]; // This should be: cin >> temp[x - 1]; }
Arrays are zero based in C++, so this is going to write beyond the end and never write the first element in your original code.