Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Data And Information Quality Dimensions, Principles And Techniques

Authors: Carlo Batini, Monica Scannapieco

1st Edition

3319241060, 9783319241067

More Books

Students also viewed these Databases questions

Question

12-5 How will MIS help my career?

Answered: 1 week ago