Answer to Question #260556 in C++ for Shen

Question #260556

TotalValue (value ), value2) //returns total of the 2 values

Write a function using C+* statements called Toto/P/oduction) which takes five integer artay's (amay), arrayz

array3, array4, arrayS) and an integer as the size of the arroyd as parameters. The arrayi to array4 Hold

quantity of the four (4) outlets over A days The funstion cakulates the total of each day using the

Tota/Value (value 1, value2) function and store in the array


1
Expert's answer
2021-11-03T17:48:04-0400


#include <iostream>


using namespace std;


int TotalValue(int value,int value2){
    return (value+value2);
}


void ToProduction(int array1[],int array2[], int array3[],int array4[],int array5[],int size){
    for(int i=0;i<size;i++){
        array5[i]=TotalValue(array1[i],array4[i]);
    }
    cout<<"\nOutlet 1\tOutlet 5\tTotal\n";
    for(int i=0;i<size;i++){
        cout<<array1[i]<<"\t"<<array4[i]<<"\t"<<array3[i]<<endl;
    }
}
int main()
{
    int size;
    cout<<"\nEnter number of elements in the arrays: ";
    cin>>size;
    
    int array1[size];
    int array2[size];
    int array3[size];
    int array4[size];
    int array5[size];
    cout<<"\nEnter elements for array 1: ";
    for(int i=0;i<size;i++){
        cin>>array1[i];
    }
    cout<<"\nEnter elements for array 2: ";
    for(int i=0;i<size;i++){
        cin>>array2[i];
    }
     cout<<"\nEnter elements for array 3: ";
    for(int i=0;i<size;i++){
        cin>>array3[i];
    }
     cout<<"\nEnter elements for array 4: ";
    for(int i=0;i<size;i++){
        cin>>array4[i];
    }
    
    ToProduction(array1,array2,array3,array4,array5,size);


    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS