Halp
Code:
Output:
Max should stay the same. I don't even see HOW it's changing. It feels like a "deeper" problem than the code.. if that makes sense.
Code:
Code:
#include <iostream>
using namespace std;
//Function Declarations
void get_input(int &, double *);
int main()
{
int max = 0;
double num [max];
get_input(max, num);
return 0;
}
void get_input(int & max, double num[])
{
while (max > 50 || max < 1)
{
cout << "How many doubles do you wish to add? "; cin >> max;
if (max > 50 || max < 1)
{
cout << endl << "That is an invalid size. You must enter an integer between 1 and 50." << endl;
}
}
for (int i = 1; i <= max; i++)
{
cout << "\nMaximum: " << max << endl;
cout << "Enter number " << i << ": "; cin >> num[i];
cout << "Number " << i << ": " << num[i] << endl;
}
}
Output:
Code:
How many doubles do you wish to add? 5
Maximum: 5
Enter number 1: 1
Number 1: 1
Maximum: 5
Enter number 2: 2
Number 2: 2
Maximum: 1073741824
Enter number 3: 3
Number 3: 3
Maximum: 1073741824
Enter number 4: 4
Number 4: 4
Maximum: 1073741824
Enter number 5: 5
Number 5: 5
Maximum: 1073741824
Enter number 6:
. . .
etc,etc
Max should stay the same. I don't even see HOW it's changing. It feels like a "deeper" problem than the code.. if that makes sense.