Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ All you have to do in this assignment is get the multi-module program you saw in class up and running! Login to your ssh

C++

All you have to do in this assignment is get the multi-module program you saw in class up and running! Login to your ssh account and create the HW15 directory. Then, in that directory you can create main.cpp, date.h and date.cpp files. Get them all bundled up together with the compiler and linker so that you have an executable that works. Here's some more information about the files:

main.cpp -- this file contains the main function, which creates a single Date variable and passes it as an argument to the GetDate function, then to the DispDate function.

date.cpp -- this file contains the implementations of the GetDate and the DispDate functions, which are called from the main module. The GetDate function takes as input a non-const reference to a Date variable; it then prompts the user to enter the month, day and year values, which are stored in the formal parameter. The DispDate function takes as input a const reference to a Date variable; this is used to display the date in proper format (e.g., MM/DD/YYYY). Both of these functions have a void return type.

date.h -- this is the header file for the date.cpp file, it contains the declaration of the Date structure, as well as the prototypes for the GetDate and the DispDate functions.

A couple of notes in building the program:

g++ is used as both the compiler and the linker. If you want to only compile a module without invoking the linker you can use the -c switch, which compiles only but doesn't link (e.g., <="" b="">will only create main.o, it won't invoke the linker). You should do this for each individual .cpp file so that you end up with a corresponding .o file. Thus, there's a one-to-one correspondance between .cpp and .o files.

You don't need to compiler header files, only .cpp files. That's because the compiler translates executable code into machine language instructions for the processor to execute, and header files should only contain information for the compiler, not code that will allocate memory.

Once you've built your object files you can link them together to create a.out, you just list the object files on the command line when running g++ (e.g., g++ main.o date.o will link the two object files together and create a.out).

Many (but not all) of the programs for the rest of this semester will involve multiple modules, so it's important to master managing projects like this. So get on top of it and become an expert as soon as possible!

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

Datacasting How To Stream Databases Over The Internet

Authors: Jessica Keyes

1st Edition

007034678X, 978-0070346789

More Books

Students also viewed these Databases questions

Question

Write a short note on rancidity and corrosiveness.

Answered: 1 week ago

Question

1. Prepare a flowchart of Dr. Mahalees service encounters.

Answered: 1 week ago