int tempSize;
//bool file = false;
std::string fileName;
// diddnt know how else to make a variable limit for the amount of numbers input without a vector.
cout << "how many numbers will be in your array? ";
cin >> tempSize;
if (cin.fail()) {
cin.clear();
cin.ignore();
cout << "There was an error with the number you put in, try again: ";
cin >> tempSize;
}
// array1(tempSize);
//cout << "Enter your entire first array: ";
cout << "fill your array by entering a row of numbers: ";//seperated by white space
int n;
for (int i = 0; i < tempSize; i++) {
cin>>n;
if (cin.fail()) {
cin.clear();
cin.ignore();
}
else {
array1[i] = array1[n];
}
}
This is what im using. The input will be an array of ints from 10 to 100 ints long. is there a way to allocate the array without asking the user for the # of #s? and is there a better way to fill them? Not allowed to use vector library or math library