Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The following homework is regarding C++ in Unix System With console logging enabled, write a program that consists of two C++ source files. The first

The following homework is regarding C++ in Unix System

With console logging enabled, write a program that consists of two C++ source files. The first file contains the main() routine and the second file contains a C++ procedure. From within main(), you must display the count of command line arguments to stdout. Further, you must display the value of each command line argument to stdout. Finally, you must call the procedure that is defined in the second file. From within the procedure defined in the second file, you must display a log message that states you are inside the procedure. This log message must be sent to stderr.

Please explain in step by step detail how to compile the source files into executable code and then how to run the program once the code is compiled to ensure the output is displayed correctly.

Example Output

$> compile.sh Setting

TEMPDIR environment variable to /scratch

Compiling file1.cc

Compiling file12.cc

Linking files to create executable hw1

Done

$> run.sh

Running 'hw1' with 0 arguments:

stdout appended to stdout.txt

stderr appended to stderr.txt

Running 'hw1' with 1 argument:

stdout appended to stdout.txt stderr appended to stderr.txt

Running 'hw1' with 5 arguments:

stdout appended to stdout.txt stderr appended to stderr.txt

$> more stdout.txt argc was

: 1 ./hw1

Done!

argc was: 2

./hw1 abc Done!

argc was:

6 ./hw1 a b c d e

Done! $>

more stderr.txt

Inside proc1() as stderr

Inside proc1() as stderr

Inside proc1() as stderr

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

Databases Illuminated

Authors: Catherine M. Ricardo, Susan D. Urban, Karen C. Davis

4th Edition

1284231585, 978-1284231588

More Books

Students also viewed these Databases questions

Question

LO 273 What factors aff ect a child during the mothers pregnancy?

Answered: 1 week ago

Question

To identify HRM functions when it is created.

Answered: 1 week ago

Question

To understand the role of HRM as a business development partner.

Answered: 1 week ago