Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please show all output for program and test. 1. Please write the following in C++ also please show all output code and comment on code.

Please show all output for program and test.

1. Please write the following in C++ also please show all output code and comment on code.

2. Also, use CPPUnitLite to write all test and show outputs for each test.

Write CppUnitLite tests to verify correct behavior for all the exercises. The modifications are aimed at making the exercises more conducive to unit tests.

Write a function that swaps (exchanges the values of two integers). Use int* as the argument type. Write a second swap function using a reference (i.e., int&) as the argument type.

Define a table of the names of months of the year and the number of days in each month. Write out that table to a stringstream. Do this twice; once using an array of char for the names and an array for the number of days and a second time using an array of structures, with each structure holding the name of a month and the number of days in it.

Write a function cat() that takes two C-style strings (i.e., char*) arguments and returns a C-style string that is the concatenation of the arguments. Use new to find store for the result. Write a second function cat that takes two const std::string& arguments and returns a std::string that is a concatenation of the arguments. The std::string version does not require new. Which is the better approach? Explain your rationale for which is the better approach?

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

OCA Oracle Database SQL Exam Guide Exam 1Z0-071

Authors: Steve O'Hearn

1st Edition

1259585492, 978-1259585494

More Books

Students also viewed these Databases questions

Question

Are the rules readily available?

Answered: 1 week ago

Question

Have ground rules been established for the team?

Answered: 1 week ago

Question

Is how things are said consistent with what is said?

Answered: 1 week ago