So I'm creating an empty array and assigning to its first 4 elements some values. I'm copying the same code into Visual Studio and the program doesn't work because it can't understand the line. So how in C++ declare empty arrays?
#include <iostream>
using namespace std;
double inTotal(double quartersQuantity, double dimesQuantity, double
nickelsQuantity, double penniesQuantity) {
double total = 0.25 * quartersQuantity + 0.10 * dimesQuantity + 0.05 *
nickelsQuantity + 0.01 * penniesQuantity;
return total;
}
int main(int argc, const char * argv[]) {
string coinNames[] = {"quarters", "dimes", "nickels", "pennies"};
double coinQuantity[] = {};
int counter = 0;
for (string values : coinNames) {
cout << "How many " << values << " do you have\n";
cin >> coinQuantity[counter];
counter++;
}
double total = inTotal(coinQuantity[0], coinQuantity[1],
coinQuantity[2], coinQuantity[3]);
cout << "Your dollar value is " << total << " dollars." << endl;
return 0;
}

std::vector, which can expand as needed when you use e.g.v.push_back( blah );.