Question: My code is correct. I just need help on changing my longest sequence cout statments to print the array instead of the letter that I

My code is correct. I just need help on changing my longest sequence cout statments to print the array instead of the letter that I have. This is how it should look

Longest sequence of {1,2,3,4,4,4,5,7,9,10} is 5

Longest sequence of {0,1,3,4,5,6,7,8,9,10} is 8.

Longest sequence of {0,1,3,4,5,7,10,11,12,13} is 4

#include #include #include using namespace std;

void readData(int A[],int B[],int C[]) { ifstream fin; fin.open("arrays.txt"); for(int i=0;i<10;i++) fin>>A[i]; for(int i=0;i<10;i++) fin>>B[i]; for(int i=0;i<10;i++) fin>>C[i]; }

void printArray(int A[],int n) { cout<<"["; for(int i=0;i

void reverseArray(int A[],int n) { for(int i=0;i

int longestSequence(int A[],int n) { int cnt=2; int length=1; for(int i=1;i

int main() { int A[10],B[10],C[10]; readData(A,B,C); cout<<"Array A: "; printArray(A,10); cout<<"Array B: "; printArray(B,10); cout<<"Array C: "; printArray(C,10); reverseArray(A,10); cout<<"Reversed Array A: "; printArray(A,10);

cout<<"Longest sequence of A: "<

return 0; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!