Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#include using namespace std; bool equals(int a[], int a_size, int b[], int b_size) { if (a_size == b_size) { for (int i = 0; i

#include using namespace std; bool equals(int a[], int a_size, int b[], int b_size) { if (a_size == b_size) { for (int i = 0; i < a_size; i++) { if (a[i] != b[i]) { return false; } } return true; } else { return false; } } int main() { char repeat; float avalue, bvalue; int a_value[20], b_value[20]; int a_size = 0; int b_size = 0; do { cout << "Enter the first array value (Q/q to stop) = "; while (cin >> avalue) { a_value[a_size] = avalue; a_size++; } cout << "Enter the second array value (Q/q to stop) = "; while (cin >> bvalue) { b_value[b_size] = bvalue; b_size++; } cout << "Array A = { "; for (int i = 0; i < a_size; i++) { cout << a_value[i] << " "; } cout << "}." << endl; cout << "Array B = { "; for (int i = 0; i < b_size; i++) { cout << b_value[i] << " "; } cout << "}." << endl; cout << "Size of array A = " << a_size << endl; cout << "Size of array B = " << b_size << endl; if (equals(a_value, a_size, b_value, b_size)) { cout << "Both arrays are the same. " << endl; } else { cout << "Two arrays are difference. " << endl; } cout << "Do you want continue (y/n): "; cin >> repeat; } while (repeat == 'y'); cout << "Exit!" << endl; system("Pause"); return 0; } student submitted image, transcription available below

can't input second array

Enter the first array value (Q/q to stop) =1234 Enter the second array value (Q/q to stop) = Array A={1234} Array B={}. Size of array A=4 Size of array B=0 Two arrays are difference. Do you want continue (y/n): Exit! Press any key to continue

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Students also viewed these Databases questions