Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1) 2) (a) Use typedef to define a type named Spreadsheet corresponding to a 2- dimensional array of positive or negative integers with dimensions NUMROWS

1)

image text in transcribed

2)

image text in transcribed

(a) Use typedef to define a type named Spreadsheet corresponding to a 2- dimensional array of positive or negative integers with dimensions NUMROWS and NUMCOLS, assuming NUMROWS and NUMCOLS have been defined as constants. (b) Write a complete C++ function named writeSpreadsheet that, for example, can be called by write Spreadsheet (my_array, 21, 5, "my_file.txt"); to write 21 lines of 5 integers each into a file called "my_file.txt" from a Spreadsheet named my_array. (CEITHER explain why your writeSpreadsheet function in part (b) facilitates design by contract OR write a line of code that could be added to facilitate design by contract and explain its purpose. (d) Would you consider the Spreadsheet type an aggregate data type? Explain. (a) Write a declaration for a C++ structured-record type named Counter that includes two integer fields named counter_value and counter_upper. Choose the most suitable type for fields that will hold only nonnegative integer values. (b) The counterinitialize function can be used to initialize any Counter variable to any appropriate given values for the counter value and its upper bound. The provided values should be nonnegative and the counter value should be less than its upper bound. Write an interface specification (fancy comments) that describes the counterlnitialize function in the style described (a) Use typedef to define a type named Spreadsheet corresponding to a 2- dimensional array of positive or negative integers with dimensions NUMROWS and NUMCOLS, assuming NUMROWS and NUMCOLS have been defined as constants. (b) Write a complete C++ function named writeSpreadsheet that, for example, can be called by write Spreadsheet (my_array, 21, 5, "my_file.txt"); to write 21 lines of 5 integers each into a file called "my_file.txt" from a Spreadsheet named my_array. (CEITHER explain why your writeSpreadsheet function in part (b) facilitates design by contract OR write a line of code that could be added to facilitate design by contract and explain its purpose. (d) Would you consider the Spreadsheet type an aggregate data type? Explain. (a) Write a declaration for a C++ structured-record type named Counter that includes two integer fields named counter_value and counter_upper. Choose the most suitable type for fields that will hold only nonnegative integer values. (b) The counterinitialize function can be used to initialize any Counter variable to any appropriate given values for the counter value and its upper bound. The provided values should be nonnegative and the counter value should be less than its upper bound. Write an interface specification (fancy comments) that describes the counterlnitialize function in the style described

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

Harness The Power Of Big Data The IBM Big Data Platform

Authors: Paul Zikopoulos, David Corrigan James Giles Thomas Deutsch Krishnan Parasuraman Dirk DeRoos Paul Zikopoulos

1st Edition

0071808183, 9780071808187

More Books

Students also viewed these Databases questions

Question

1. What are the benefi ts of studying communication?

Answered: 1 week ago