Name: ____________________________________________________ Alpha: _____________________
Describe help received: _________________________________________________________________
int n;
cin >> n;
double *Z;
Z = new double[n];
if (n <= 0)
{
cout << "Error!" << endl;
Z = new double[10];
}
Z[0] = 5;
...
|
int n;
cin >> n;
if (n <= 0)
{
cout << "Error!" << endl;
double *Z = new double[10];
}
else
double *Z = new double[n];
Z[0] = 5;
...
|
int n;
cin >> n;
double *Z;
if (n <= 0)
{
cout << "Error!" << endl;
Z = new double[10];
}
else
Z = new double[n];
Z[0] = 5;
...
|
|
compile-time error / possible run-time error / OK If error, why? |
compile-time error / possible run-time error / OK If error, why? |
compile-time error / possible run-time error / OK If error, why? |
int i = 0; while(A[i] != x && i < n) i++; if (i == n) cout << "Not found!"; else cout << "Found!"; cout << endl; |
int i = 0; while(i < n && A[i] != x) i++; if (i == n) cout << "Not found!"; else cout << "Found!"; cout << endl; |
for(int i = 0; i < n && A[i] != x; i++) ; if (i == n) cout << "Not found!"; else cout << "Found!"; cout << endl; |
|
works / doesn't work If doesn't work, why? |
works / doesn't work If doesn't work, why? |
works / doesn't work If doesn't work, why? |
N = 6 X: 1 1.5 2 3.1 6 8.3 Y: 5.5 5.2 5.1 5.2 5.7 6.6and output them as ordered pairs, i.e. like this:
(1,5.5) (1.5,5.2) (2,5.1) (3.1,5.2) (6,5.7) (8.3,6.6)Turn In a screen capture of your program running on the file Input.txt and the source code for your program. (Hint: This is most easily done with two arrays.)