Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

“Hello World” “Hello World My Name is Your Complete Name”, Exams of Logic

Purpose: To help students become familiar with programming in C++ using Visual ... Next, students will add code to display the word "Hello World My Name is ...

Typology: Exams

2021/2022

Uploaded on 09/12/2022

anvi
anvi 🇺🇸

4.8

(4)

228 documents

1 / 15

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Baton Rouge Community College STEM (Computer Science)
High Performance Computing Curriculum Module
Debra Miller Borskey, CS Associate Professor
LSU LASIGMA RET Summer 2014
Introduction to C++ using Visual Studio
Course: CSCI 192 Introduction to Computers: Programming Logic and Design
Purpose: To help students become familiar with programming in C++ using Visual Studio
Objectives: At the end of this module students will be able to:
Understand and use the basic programming constructs of C++
Manipulate C++ data types, such as integers and strings
Isolate and fix common errors in C++ programs
Apply object-oriented approaches to software problems in C++
Write small-scale C++ programs using the above skills
Use an Integrated Development Environment to program in C++
“Hello World”
Using your notes and the example below, provide the flow chart logic for a C++
program that produces the following output:
“Hello World My Name is Your Complete Name”
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff

Partial preview of the text

Download “Hello World” “Hello World My Name is Your Complete Name” and more Exams Logic in PDF only on Docsity!

Baton Rouge Community College STEM (Computer Science)

High Performance Computing Curriculum Module

Debra Miller Borskey, CS Associate Professor

LSU LASIGMA RET Summer 2014

Introduction to C++ using Visual Studio

Course: CSCI 192 Introduction to Computers: Programming Logic and Design

Purpose: To help students become familiar with programming in C++ using Visual Studio

Objectives: At the end of this module students will be able to:

Understand and use the basic programming constructs of C++Manipulate C++ data types, such as integers and stringsIsolate and fix common errors in C++ programsApply object-oriented approaches to software problems in C++Write small-scale C++ programs using the above skillsUse an Integrated Development Environment to program in C++

“Hello World”

Using your notes and the example below, provide the flow chart logic for a C++

program that produces the following output:

“Hello World My Name is Your Complete Name”

Provide the pseudo code of the program typed below.

Start

Declarations

String myName

input myName

output “Hello World My Name is “ myName

stop

  1. On the menu bar, choose File, New, Project.
  2. Select the Visual C++ category, choose the Win32 Console Application template, and then name the project HelloWorldMyNameApp. Next, click OK.
  1. When the Win32 Application Wizard appears, choose the Finish button.
  2. The HelloWorldMyNameApp project and solution, with the basic files for a Win32 console app, are created and automatically loaded into Solution Explorer. The HelloWorldMyNameApp.cpp file is opened in the code editor. The following items appear in Solution Explorer:
  3. Next, students will add code to display the word "Hello World My Name is Your Name" in the console window.
  1. Save the changes to the file.

Debug HelloWorldMyNameApp to see if the phrase "Hello World My Name is Your Name" appears in the console window.

To debug the app

  1. Start the debugger.
  2. The debugger starts and runs the code. The console window (a separate window that looks like a command prompt) appears and prompts the user to enter a name. Once the name is entered, for a few seconds the console window appears. However the window closes quickly when the debugger stops running. To see the text, set a breakpoint to stop program execution.

To add a breakpoint

  1. Add a breakpoint from the menu bar at the line return 0;. Also users can just click in the left margin to set a breakpoint.
  2. A red circle appears next to the line of code in the far left margin of the editor window.
  3. Choose the F5 key to start debugging.
  4. The debugger starts, and a console window appears prompting the user for a first and last name, then showing the phrase “Hello World My Name is Your Name”. 5. Press SHIFT + F5 to stop debugging.

Congratulations on completing the first walkthrough!

Students may also try using Visual Studio and the steps provided to run,

compile, debug and save the program. Remember, format work nicely.

Steps may vary to Create, Check for Errors and Execute a C++ Program

  1. Open Visual Studio 2013
  1. Select Start New project and select the Visual C++ - Template on Left the Hand Side, Win

32 Console Application on Right Hand Side, Name the Project – on the Bottom Center of the Dialog Box, next Click Ok – on the Bottom Right of the Dialog Box

  1. Use the Wizard Dialog Box and Click Application Settings on Left Side of the Dialog Box
  1. On the Left Side Select Visual C++ and On the Right Side Select C++ File and you may use the same project name for the File on Bottom Center then Click Add on Bottom Right
  2. Type in your C++ program
  3. Select Build or F7 Check for Errors
  4. Select Debug or CTRL F5 to Execute and See Results
  5. Students may also use the debug menu and select start without debugging to have the screen pause automatically.

“All About Me”

Using the examples provided below and your notes, provide the logic for a C++ program that declares the necessary variables needed and then prompts you the user to input your first and last name, birth city, state, one hobby and your age. The program next calculates the number of years before you may withdraw Social Security given 62 begins eligibility. The program also calculates how much money you will have invested in Social Security provided 600 dollars a year is saved from your current age to age 62. The program should use good input prompts and output all input data plus calculations. (Be sure to clearly indicate all data in the output). Remember to use the necessary C++ statements as practiced in class.

  1. As discussed in class, students need to include the following lines before main in the C++ Program:
  2. Using the code below, next type the main module of the program.