C++ CODE:
#include<iostream>
#include<fstream>
using namespace std;
int main()
{
cout<<"JOIN ARRAYS"<<endl;
ifstream fin;
cout<<"Enter name of file 1:";
string file1;
cin>>file1;
fin.open(file1.c_str());
int m1=0;
string line;
while(fin)
{
getline(fin,line);
m1++;
}
m1--;
fin.close();
fin.open(file1.c_str());
int r;
int n1=0;
while(fin)
{
fin>>r;
n1++;
}
n1--;
n1=n1/m1;
int** arr1 = new int*[m1];
for(int i=0;i<m1; i++)
arr1[i]=new int[n1];
fin.close();
fin.open(file1.c_str());
for(int i=0;i<m1;i++)
{
for(int j=0;j<n1;j++)
{
int val;
fin>>val;
arr1[i][j]=val;
}
}
fin.close();
cout<<"Enter name of file 2:";
string file2;
cin>>file2;
fin.open(file2.c_str());
int m2=0;
while(fin)
{
getline(fin,line);
m2++;
}
m2--;
fin.close();
fin.open(file2.c_str());
int n2=0;
while(fin)
{
fin>>r;
n2++;
}
n2--;
n2=n2/m2;
int** arr2 = new int*[m2];
for(int i=0;i<m2; i++)
arr2[i]=new int[n2];
fin.close();
fin.open(file2.c_str());
for(int i=0;i<m2;i++)
{
for(int j=0;j<n2;j++)
{
int val;
fin>>val;
arr2[i][j]=val;
}
}
fin.close();
cout<<"Enter the column no. for comparison in first
matrix(starting from 0): ";
int c1;
cin>>c1;
cout<<"Enter the column no. for comparison in second
matrix(starting from 0): ";
int c2;
cin>>c2;
for(int i=0;i<m1;i++)
{
for(int j=0;j<m2;j++)
{
if(arr1[i][c1]==arr2[j][c2])
{
for(int k=0;k<n1;k++)
cout<<arr1[i][k]<<" ";
for(int k=0;k<n2;k++)
cout<<arr2[j][k]<<" ";
cout<<endl;
}
}
}
return 0;
}
Input file:
file01.txt

file02.txt

Output:

Write a C# or C++ code to do the following: -Ask user for name of file1...
Write a program to merge two sorted arrays into a third array. Ask the user to enter the size of the two arrays. The length of array1 could be greater than, equal to or less than the length of array2. Fill both with random numbers 0-99. Sort both arrays as explained below. Write a method merge that takes the two arrays as arguments. The method returns a merged array with size equal to the size of both arrays combined. Note:...
Program is in C++, program is called airplane reservation. It is suppose to display a screen of seating chart in the format 1 A B C D E F through 10. I had a hard time giving the seats a letter value. It displays a correct screen but when I reserve a new seat the string seats[][] doesn't update to having a X for that seat. Also there is a file for the struct called systemUser.txt it has 4 users...
Using java :
In this exercise, you need to implement a class that encapsulate
a Grid. A grid is a useful concept in creating board-game
applications. Later we will use this class to create a board game.
A grid is a two-dimensional matrix (see example below) with the
same number of rows and columns. You can create a grid of size 8,
for example, it’s an 8x8 grid. There are 64 cells in this grid. A
cell in the grid...
Write a bash shell script to carry out each of the following tasks: What to Do: a. Safe Delete: When you use the “rm” command in Linux, it will delete the specified files, with no chance for recovering them back later. Write a script (called srm) that will safely delete the files passed to it as command-line arguments. For example, typing the command: “srm file1 file2 file3”, the script shall not actually delete these files, but instead it shall move...
Write a code using loop and flag function in python jupitior notebook: Ask the user for the number of items they bought. Also ask the price of each item they bought and quantity purchased. Display the total amount they owe. Ask the user for a number n. Calculate 1+2+3+….+n. Ask the user for a number n. Calculate 1*2*3*…*n. Ask the user for number of rows (r) and columns (c). Print * for r rows and c columns. Ask the user...
This program is in C++ which reserves flight seats. It uses a file imported to get the seat chart called "chartIn.txt" which looks like this 1 A B C D E F 2 A B C D E F It continues until row 10. Sorry unable to provide the chartIn.txt file. I am having issues with function displaySeats, it displays then but when it comes to 10 the row looks like this 1 0 A B C D E ,...
Can I get help with adding the following to this code please? 1. When buying multiple tickets, if one of the seats selected is already taken, give a message like "Sorry, one or more of the seats selected is already taken." and prompt the user to select the seats all over. (Or if possible to make it suggest a location where the seats are together that the user can select instead) 2. Print the total cost after all of the...
Can you help us!! Thank you!
C++
Write a program that can be used by a small theater to sell tickets for performances. The program should display a screen that shows which seats are available and which are taken. Here is a list of tasks this program must perform • The theater's auditorium has 15 rows, with 30 seats in each row. A two dimensional array can be used to represent the seats. The seats array can be initialized with...
i need help writing these programs in c++ format
1. Enter two integer arrays: array1-129, 0, -56, 4, -7 and array2-19, 12, -36, -2, 12 3. Write the code to form and display another array array3 in which each element is the sum of numbers in the position in both arrays. Use pointers and functions: get array0. process arrays0 and show array0 (50 points) 2. Enter a positive 5-digit integer via the keyboard. Display each digit and fol- lowed by...
below is my code please help me edit it so in the beginning it ask for Press any key to start Task n, where n is the task number (1, 2, or 3,4). I already wrote the code for the 4 task. Also please write it so when 1 code is finish running it return to the prompt where it ask to run another task #task 1 list1 = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','0','1','2','3','4','5','6','7','8','9','.',',','?'] morse = ['.-','-...','-.-.','-..','.','..-.','--.','....','..','.---','-.-','.-..','--','-.','---','.--.','--.-','.-.','...','-','..-','...-','.--','-..-','-.--','--..','-----','.----','..---','...--','....-','.....','-....','--...','---..','----.','.-.-.-','--..--','..--..'] inp = input("Enter original text : ")...