Please Edit my CODE: #include <iostream> #include <ctime> #include <cstdlib> con
ID: 655438 • Letter: P
Question
Please Edit my CODE:
#include <iostream>
#include <ctime>
#include <cstdlib>
const int ARRAY_SIZE = 5;
const int numArray = 5;
const int Array = 5;
void generateRandomArray(int Array[ARRAY_SIZE], int nElement)
{
int srand(time(0)); //"the seed"
int numbers [5];
for (int n = 0; n < 5; n++)
{
//Number between 0 & 10
numbers[n] = rand() % 10 + 1; //genereates # 1-10
}
}
int main()
{
using namespace std;
string
int test_Array[ARRAY_SIZE] = {};
generateRandomArray(int [ARRAY_SIZE], int nElement);
return 0;
}
Prompt: Please write a C++ program that computes the average score for a student. The program instructs the user to Input the student
Explanation / Answer
#include <iostream>
#include <ctime>
#include <cstdlib>
const int ARRAY_SIZE = 5;
const int numArray = 5;
const int Array = 5;
void generateRandomArray(int Array[ARRAY_SIZE])
{
int srand(time(0)); //"the seed"
int numbers [5];
for (int n = 0; n < 5; n++)
{
//Number between 0 & 10
numbers[n] = rand % 10 + 1;
}
}
int main()
{
using namespace std;
string
int test_Array[ARRAY_SIZE] = {};
generateRandomArray(int [ARRAY_SIZE], int nElement);
return 0;
}
2-
#include <iostream>
using namespace std;
int main()
{
int num;
num = 6;
cout << "My first C++ program." << endl;
cout << "The sum of 2 and 3 = " << 5 << endl;
cout << "7 + 8 = " << 7 + 8 << endl;
cout << "Num = " << num << endl;
return 0;
}
Sample Run: (When you compile and execute this program, the following four lines are
displayed on the screen.)
My first C++ program.
The sum of 2 and 3 = 5
7 + 8 = 15
Num = 6
These lines are displayed by the execution of the following three statements.
cout << "My first C++ program." << endl;
cout << "The sum of 2 and 3 = " << 5 << endl;
cout << "7 + 8 = " << 7 + 8 << endl;
cout << "Num = " << num << endl;