Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Name August 2, 2018 OSC 504 Final Examination nswer each of the following. This

ID: 3920366 • Letter: N

Question

Name August 2, 2018 OSC 504 Final Examination nswer each of the following. This is a closed book and notes examination. You are nly allowed to use the data structures that are indicated by the problem. You may not troduce any additional data structures without approval. You have a text file and each line ends with an end-of-line character. Write a subprogram to print the lines of data from the file in normal order or reverse order based on the following criteria. If the first character in the line of text is an uppercase ASCII alphabetic character, then the line is printed in reverse order. If the first character in the line of text is a lowercase ASCII alphabetic character, then the line of text is printed in normal order. If the line of text begins with neither, then it is not printed. Use stacks to help you implement this subprogram.

Explanation / Answer

#include<iostream>

using namespace std;

//7 boolean recursive program to find two lists are equal or not

//returns true if equal

//otherwise false

bool areEqual(int Aray[],int Bray[],int Asize,int Bsize)

{

if(Asize!=Bsize)//if size not equal...then they are not equal

return false;//then returning false

int i=0;

while(i<Asize)//to traverse arrays..

{

if(Aray[i]!=Bray[i])//matching each elements

return false;//if a mismatch found then returning false

i++;

}

//if do not find any mismatch then

return true;

}

int main()

{

//testing..

int a[] = {1,2,3,4},b[]={1,2,3,4},c[]={1,2,3},d[]={1,2,2,4};

if(areEqual(a,b,4,4))cout<<"A,B are equal ";

else cout<<"A,B are not equal ";

if(areEqual(c,b,3,4))cout<<"C,B are equal ";

else cout<<"C,B are not equal ";

if(areEqual(c,d,3,4))cout<<"C,D are equal ";

else cout<<"C,D are not equal ";

if(areEqual(a,d,4,4))cout<<"A,D are equal ";

else cout<<"A,D are not equal ";

return 0;

}

A,B are equal
C,B are not equal
C,D are not equal
A,D are not equal


Process exited normally.
Press any key to continue . . .