Design a program that will create six one dimensional integer arrays with 10 ele
ID: 3771207 • Letter: D
Question
Design a program that will create six one dimensional integer arrays with 10 elements each. 1. create and initialize array 1 and array 2 using amodule that will either prompt the user to input the elements in the array or use the random number generator function to generate the numbers. 2. create and initialize the remaining 4 arrays with zeros. 3. create the module that will print out all the arrays for steps 1 & 2. 4. create the module that will calculate the sum operation. 5. create the module that will calculate the product operation.
I need a flow chart and algorithm
Explanation / Answer
#include<iostream.h>
#include<conio.h>
#include<stdlib.h>
class arr_6
{
public:
int a[10],b[10],c[10],d[10],e[10],f[10];
void first_sec()
{
for(int i=0;i<10;i++)
{
a[i]=rand()%10;
b[i]=rand()%20;
c[i]=0;
d[i]=0;
e[i]=0;
f[i]=0;
}
}
void print()
{
int i;
for(i=0;i<10;i++)
{
cout<<a[i]<<endl;
}
for(i=0;i<10;i++)
{
cout<<b[i]<<endl;
}
for(i=0;i<10;i++)
{
cout<<c[i]<<endl;
}
for(i=0;i<10;i++)
{
cout<<d[i]<<endl;
}
for(i=0;i<10;i++)
{
cout<<e[i]<<endl;
}
for(i=0;i<10;i++)
{
cout<<f[i]<<endl;
}
}
void product()
{
for(int i=0;i<10;i++)
{
cout<<a[i]*b[i]<<endl;
}
}
};
void main()
{
arr_6 o;
o.first_sec();
o.print();
o.product();
getch();
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.