Question: Program 1 #include #include using namespace std; int main() { int size; //Section 1 - Array Definitions int readings[-1]; float measurements[4.5]; string names[size]; //Section 2
Program 1
#include
#include
using namespace std;
int main()
{
int size;
//Section 1 - Array Definitions
int readings[-1];
float measurements[4.5];
string names[size];
//Section 2
const int SIZE = 100;
int numbers[SIZE];
for (int i = 1; i <= SIZE; i++)
numbers[i] = i;
}
Questions: 1) In the lines under the comment labeled Section 1, what is incorrect about these variable declarations? Rewrite the lines so that they are valid C++ statements that will compile. 2) Under Section 2, is there a problem with these lines of code? If so, how do you fix them?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
