Answer to Question #245598 in C++ for john

Question #245598

Let P = {2,3,4,5,6}, Q = {1, 3, 5, g} and R = {1, 2, 4, h}Find P – Q, Q – P and P Δ 


1
Expert's answer
2021-10-02T07:24:25-0400
//Let P = {2,3,4,5,6}, Q = {1, 3, 5, g} and R = {1, 2, 4, h}Find P – Q, Q – P and P Δ
#include <iostream>
#include <array>;
using namespace std;


int main()
{
   int i,d,g,h;
   int P [5] = {2,3,4,5,6}; //initializing first array
   int Q [4] = {1, 3, 5,g}; //initializing second array
   int R [4] = {1, 2, 4, h}; //initializing third array
   for (i= 0; i<5; i++)
   {
      P[i]-=Q[i]; // aggregate the difference between the array of p and q
      Q[i]-=P[i];
      R[i]-=P[i];


   }
   //print the results
   std::cout<<"The Value of P minus Q is ";
   for(i=0; i<5; i++) std::cout<<P[i]<<" ";
   std::cout<<std::endl;
   std::cout<<"The value Q minus P is ";
   for(i=0; i<5; i++) std::cout<<Q[i]<<" ";
   std::cout<<std::endl;
   std::cout<<"The value Q minus P is ";
   for(i=0; i<5; i++) std::cout<<R[i]<<" ";
   std::cout<<std::endl;
   d= R[i]+Q[i];


   cout<<"The change of P Δ is "<<d<<endl;


    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