Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

write a c program that does this: create 2 files that store: + list of number, each per line + -1 will be a marker

write a c program that does this:

create 2 files that store:

+ list of number, each per line

+ -1 will be a marker to end the data

+ all value in the file will >=0 other than the -1 marker

for example:

fileA:

3

2

4

-1 (marker end the list of data)

fileB:

1

2

3

0

-1 ( marker end the list of data)

create 2 functions with 3 variable R A and B:

int combiner (int R[], int A[], int B[] )

int zipper (int R[], int A[], int B[] )

- A & B are passed in; do not modify

- R is the result that is set by the function

- Return the number of items in R when finished ( -1 does not count )

8 12 -1 would be 2 items

- R must have the -1 end marker

specifics on the functions:

int combiner( int R[], int A[], int B[] )

- A and B are in sorted order; you do not need to check or sort

- Combine the values into R so that R contains all values & is sorted

int zipper( int R[], int A[], int B[] )

- A and B can be any lists

- Take from A then B then A then B... until the list is used up.

- If one list is shorter continue to add values from the other.

the program will read 2 files from the user. example fileA and fileB.

./a.out fileA fileB

R combiner: 0 1 2 3 4 -1

R zipper: 3 1 2 2 4 3 0 -1

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_2

Step: 3

blur-text-image_3

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

Practical Oracle8I Building Efficient Databases

Authors: Jonathan Lewis

1st Edition

0201715848, 978-0201715842

More Books

Students also viewed these Databases questions

Question

What are Decision Trees?

Answered: 1 week ago

Question

What is meant by the Term Glass Ceiling?

Answered: 1 week ago