Oops! It appears that you have disabled your Javascript. In order for you to see this page as it is meant to appear, we ask that you please re-enable your Javascript!

A Multiple-File Project: The Time Program

in Programing on March 26, 2015

In this demonstration, the project or program that prints a given time of the day in both military
as well as standard time formats. The project contains three files created by the programmer: two
source files (timeDemo.cpp and Time.cpp) and a header file (Time.h). Again we’ll build the
project from scratch.
Step 1: Launch Visual C++ 2010, click File à New à Project… to display the New Project
dialog box. In the dialog box, select Visual C++ in Installed Template pane and Win32
Console Applications in the middle pane. Enter project name (e.g., Time in this demo) in the
Name box and select the folder in which you’d like files for this project to be stored (e.g.,
C:UsersirwinhuDocumentsCS230 in this demo) by clicking the Browse…
Click OK to display the Win32 Application Wizard – Time dialog box.
Step 2: In the dialog box, click Next (do not click Finish) and check the Empty project.
Step 3: Add header file to Header Files folder by right clicking the folder and then click Add
In the Add New Item –Time dialog box, select Header File (.h) in the middle panel and enter an
arbitrary name (e.g., Time in this demo) for the header file:
Step 4: Similar to step 3 above, add two source files (must be .cpp type; but the file names can be
arbitrary, e.g., Time.cpp and TimeDemo.cpp in this demo), one at a time, to the Source Files folder by
right clicking the Source Files folder. The below screen shows the source code for Time.cpp file has been
entered:
Step 5: To compile, link, load, and execute or run the program, click Debug à Start Without
Debugging. Since there is no error or bug in the code, the output window displays the message
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========.
In a separate window, the program output is display below

Categories: Programing