Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Program Purpose Using Visual Studio 2017 create a CLR console application. Create a program plan and then convert it into C++ statements. Practice debugging, declaring

Program Purpose

Using Visual Studio 2017 create a CLR console application. Create a program plan and then convert it into C++ statements. Practice debugging, declaring variables, type casting, formatting output, if statements and input /output to / from the console window and files, input validation, and while loops.

Mandatory Instructions

Many spy codes are based on translating information from one representation to another. So for example, if I have a code that is of length 3, I could generate a corresponding picture. We are going to make a very simplified code translation program. You will read in an unknown number of integers from a data file lab4_input.txt. The data will be organized in the file so that there is one integer per line. Last integer will be -1 which will indicate end of data file. Program should end when this value is read. DO NOT count how many lines of data there are in the file!!!

For each integer that you read from the data file, display a list of *s. So if the number read is 4, the program would display on one line.

Display * for even numbers and $ for odd numbers.

****

Output File

The output should be the displayed *s. Name of the output file should be lab4_output.txt.

Processing

Converting integers to a list of * or $

1. Check each integer to see if it is > 0. If yes, use a while loop to display the indicated number of characters

2. Otherwise if the integer is == 0 then only output a blank line

3. Otherwise if the integer is < -1 convert the integer to a positive number and use the same loop as for (1) to display the *s or $s. DO NOT write a separate loop for this case!!!

Sample Output

$

**

$$$

****

$$$$$

****

$$$

**

$

**********

$$$$$$$

Program Documentation & Style:

1. Declare all variables and constants that your program uses at the beginning of your program.

2. Your program should include two types of comments:

a. Program banner:

// File Name : LastF_LabN.cpp (where N is your lab number)

// Description : Program description

// Author : Last, First

// Date : dd/mm/yy

b. In-line comments: There should be an in-line comment for each main step in your program. In general, this means a comment with each group of C++ statements that handles the input, the processing and the output steps of your program.

3. Use meaningful identifier names

4. Include clear prompts for the user about entering the data.

5. Include clear descriptions of the results when you display them.

DATA FILE CONTENTS: lab4_input.txt

1 2 3 4 5 4 3 2 1 0 10 23 0 -12 -10 11 6 5 7 9 -11 2 3 0 1 -1

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

Intranet And Web Databases For Dummies

Authors: Paul Litwin

1st Edition

0764502212, 9780764502217

Students also viewed these Databases questions

Question

1. How is the newspaper help to our daily life?

Answered: 1 week ago

Question

1. Prepare a short profile of Mikhail Zoshchenko ?

Answered: 1 week ago

Question

What is psychology disorder?

Answered: 1 week ago

Question

=+Trainers from headquarters? Local trainers? Independent trainers?

Answered: 1 week ago