PRG 218 Week 1 Individual: Coding: Hello, World
PRG 218 Week 1 Individual: Coding: Hello, World
Build Your First C++ App: Install
Build Your First C++ App: Introduction
Getting Started in Visual Studio on the Microsoft® Developer Network website
Introduction to Programming and the Translation Process of Starting Out with C++ from Control Structures Through Objects
Debugging in Visual Studio on the Microsoft® Developer Network website
This is a two-part assignment.
Part 1: Download and install Microsoft® Visual Studio® Community 2017, an integrated development environment (IDE) used to create C/C++ programs. Use the linked tutorial, Build Your First C++ App: Install, if you need help with installation.
Part 2: Code, test, and execute a simple C++ program using the linked tutorial, Build Your First C++ App: Introduction, to ensure your IDE is set up correctly.
Read the following sections of the article, “Build Your First C++ App: Install,” on the Microsoft®Visual Studio® website, explaining how to download and install the correct version of Microsoft® Visual Studio® Community 2017.
Note: You must install the workload Desktop Development with C++ to be able to compile and run C++ programs for this course.
After you have installed the software, follow these instructions to complete your ID configuration:
Launch Microsoft® Visual Studio® Community 2017.
From the main menu bar, choose Tools Options Debugging Symbols.
On the dialog that appears, turn on the checkbox next to Microsoft Symbol Servers.
Note: It may be helpful to read the article “Getting Started in Visual Studio” on the Microsoft®Developer Network website.
Read through the lab materials, and complete the following labs in the “Introduction to Programming and the Translation Process” document:
Lab 1.1, “Opening, Compiling, and Running Your First Program”
Lab 1.2, “Compiling a Program With a Syntax Error”
Lab 1.3, “Running a Program With a Run Time Error”
Lab 1.4, “Working With Logic Errors”
Note: Instead of opening existing files, you are required to type the C++ source code yourself for each C++ program as noted in the lab materials. Also, you will create a project each week for each C++ program you write.
Create a new project in Microsoft® Visual Studio® as follows:
Launch Microsoft® Visual Studio®.
From the main menu, choose File New Project.
On the left of the New File dialog that appears, choose Visual C++.
On the right of the New File dialog, choose Win32 Console Application.
Near the bottom of the dialog, in the Name field, type firstprog.
Note the value in the Location field. You may leave this as the default value or change it by clicking the Browse button. However, it is important that you remember the value for this field, because this value indicates the folder in which Visual Studio® will place your C++ source files. You need to know this folder because after you finish creating your source code files, you will need to navigate here using Windows® Explorer and zip the CPP files together in order to submit them.
Click the OK button.
On the dialog that appears, click the Finish button.
A .cpp (C++ source code) file will appear in the editing window. This file contains some standard C++ code. You will be editing (replacing) this code to create each C++ program.
Complete the labs in the “Introduction to Programming and the Translation Process” document as follows:
Read the lab instructions, and type the C++ code indicated in the lab instructions. The first C++ file you will create will be called firstprog.cpp.
Hint: Be sure to leave the line#include “stdafx.h”in the program. Also, be sure to insert your name where indicated in the comments for each program.
To run the program, choose Debug Start Without Debugging from the main menu, and choose Yes on the dialog that appears asking if you would like to build the program.
If your program contains no errors, a Windows console (small black window with the header C:\Windows\system32\cmd.exe and white text) will appear. For example, for firstprog.cpp, the following text will appear on your console: “Now is the time for all good men/To come to the aid of their party/Press any key to continue…” To dismiss the console, you select it and click any key, or click the x that appears in the upper right corner of the console.
If your program contains errors, a description of the errors will appear at the bottom of the screen. Read the error descriptions, follow the suggestions for fixing them (if any), and repeat the steps above until your program runs without errors.
Hint: If you need help debugging your program, try the following:
Read the Microsoft® article “Debugging in Visual Studio.”
Turn on line numbers to help you match error descriptions with specific lines of code. To do so, choose Tools Options Text Editor All Languages from the main menu, and turn on the check box next to Line Numbers on the dialog that appears, then click OK.
For additional help, post a question describing your problem in this week’s discussion board.
After you complete all four labs, you will have created four different C++ programs: firstprog.cpp, semiprob.cpp, runprob.cpp, and logicprob.cpp. These program files will be located beneath the directory specified in the Location field.
Note: If you have forgotten the location, you can find it by clicking File New Project.
Zip the four CPP source files into a single ZIP file named PRG218_Week1_YourName.zip.
Submit your ZIP file using the Assignment Files tab.