Answer:
#include <iostream>
#include <stdlib.h>
#include <time.h>
using namespace std;
// array fill and returnig array to the main()
float *arrayFill(float *arr) {
// srand() allows generate new random value everytime the program runs
srand(time(NULL));
for (int i = 0; i < 10; i++)
{
// array fill with random number between 0 to 100
arr[i] = (rand() % 100);
}
return arr;
}
// print array
void print(float* arr) {
cout << "Array: ";
for (int i = 0; i < 10; i++)
{
cout << arr[i] << " ";
}
}
float maxNum(float* arr) {
float temp = arr[0];
for (int i = 1; i < 10; i++) {
if (temp < arr[i]) {
temp = arr[i];
}
}
return temp;
}
int main() {
// creating dynamic array of elements 10 in heap memory
float *arrPtr = new float[10];
float result = 0;
// calling arrayFill()
arrPtr = arrayFill(arrPtr);
// calling print() to print array
print(arrPtr);
// calling maxNum() to find maximum number in the array
result = maxNum(arrPtr);
cout << "\nmaximum number: " << result;
delete[] arrPtr;
return 0;
}
Explanation:
please read inline comments inside the code section:)
Answer:
b. make sure the program solves the original problem
Explanation:
This is important so as to avoid logical errors. Logical errors unlike compiler or run time errors will not stop your code from compilling and executing but after your program compiles and runs, but does the wrong thing by given you unexpected results
This is the reason why validation of results after your code is completed is important in this way you are sure the program solves the original problem.
Answer: Story -
In 1951, John H. Johnson was selected as Young Man of the Year by the United States Chamber of Commerce. He was the first African-American to receive such honor. In 1966, he received Spingarn Medal by the National Association for the Advancement of Colored People for his contributions in the area of race relations.
Born -
January 19, 1918, Arkansas City, AR
Died -
August 8, 2005, Chicago, IL
Spouse -
Eunice W. Johnson
(married at 1941–2005)
Children -
Linda Johnson Rice, John Harold Johnson
Explanation:
Answer:
import random
numbers = []
even = 0
odd = 0
for i in range(100):
numbers.append(random.randint(1, 200))
for i in range(100):
if numbers[i] % 2 == 0:
even += 1
else:
odd += 1
print("Even:", even)
print("Odd:", odd)
Explanation:
Gg ez.
When reading difficult content you should- Survey the chapter.
Surveying the chapter allows you to better interpret the literary text and therefore be able to answer the following questions or summarize.
Hope I helped,
-CSX :)