Create a program operations of vectors Create two arrays of
Solution
Please follow the code and comments for description :
CODE :
#include <iostream> // required header
using namespace std;
int *insertElements(); // required functions to enter the data
 int main() // driver class
 {
    int a[5], b[5], *p, *q, choice; // reauired initisalisations
    cout << \"Enter the Elements for the First Array : \" << endl;
    p = insertElements(); // calling the function to add data
    cout << \"The Entered Elements are : \" << endl;
    for(int i = 0; i < 5; i++){ // printing the data
        cout << *(p + i) << endl;
    }
    cout << \"Enter the Elements for the Second Array : \" << endl;
    q = insertElements(); // calling the function
    cout << \"The Entered Elements are : \" << endl;
    for(int j = 0; j < 5; j++){ // printing the data
        cout << *(q + j) << endl;
    }
 
    cout << \"Select the Option You Want To Perform.\" << endl; // prompt for the user to select the data
    cout << \"-------------------------------------------\" << endl;
    cout << \"1.Addition. \" << endl;
    cout << \"2.Subtraction. \" << endl;
    cout << \"3.Multiplication. \" << endl;
    cout << \"4.Exit. \" << endl;
    cout << \"-------------------------------------------\" << endl;
 
    cin >> choice; // getting the choice
    switch(choice) { // switching the choice
     case 1 :
         cout << \"Performing the Addition : \" << endl; // performing the data addition
         cout << \"The result is : \";
         for(int x = 0; x < 5; x++){
             for(int y = x; y <= x; y++) {
                 cout << *(p + x) + *(q + y) << \" \"; // adding the data
             }
         }
         cout << \"\ \";
         break;
       
     case 2 :
         cout << \"Performing the Subtraction : \" << endl; // performing the subtraction
         cout << \"The result is : \";
         for(int x = 0; x < 5; x++){
             for(int y = x; y <= x; y++) {
                 cout << (*(p + x)) - (*(q + y)) << \" \";    // getting the data
             }
         }
         cout << \"\ \";
         break;
       
     case 3 :
         cout << \"Performing the Multiplication : \" << endl; // performing the multiplication
         cout << \"The result is : \";
         for(int x = 0; x < 5; x++){
             for(int y = x; y <= x; y++) {
                 cout << (*(p + x)) * (*(q + y)) << \" \"; // getting the data
             }
         }
         cout << \"\ \";
         break;
       
     case 4 :
         cout << \"Exiting the Code.!\" << endl; // exit teh code
         exit(0);
       
     default :
         exit(0);
    }
 
    return 0;
 }
int *insertElements() {
     static int arr[5];
     cout << \"Enter the Elements : \" << endl;
     for(int m = 0; m < 5; m++){
         cin >> arr[m];
     }
     return arr;
 }
OUTPUT :
Enter the Elements for the First Array :                                                                                                                      
  Enter the Elements :                                                                                                                                          
  1                                                                                                                                                             
  2                                                                                                                                                             
  3                                                                                                                                                             
  4                                                                                                                                                             
  5                                                                                                                                                             
  The Entered Elements are :                                                                                                                                    
  1                                                                                                                                                             
  2                                                                                                                                                             
  3                                                                                                                                                             
  4                                                                                                                                                             
  5                                                                                                                                                             
  Enter the Elements for the Second Array :                                                                                                                     
  Enter the Elements :                                                                                                                                          
  1                                                                                                                                                             
  2                                                                                                                                                             
  3                                                                                                                                                             
  4                                                                                                                                                             
  5                                                                                                                                                             
  The Entered Elements are :
 1                                                                                                                                                             
  2                                                                                                                                                             
  3                                                                                                                                                             
  4                                                                                                                                                             
  5                                                                                                                                                             
  Select the Option You Want To Perform.                                                                                                                        
  -------------------------------------------                                                                                                                   
  1.Addition.                                                                                                                                                   
  2.Subtraction.                                                                                                                                                
  3.Multiplication.                                                                                                                                             
  4.Exit.                                                                                                                                                       
  -------------------------------------------                                                                                                                   
  2                                                                                                                                                             
  Performing the Addition :                                                                                                                                  
  The result is : 2 4 6 8 10
 Hope this is helpful.



