This week’s assignments deal with files and nested loops. Input: The program prompts for the name of an input file and the name of an output file. The input file contains two positive (non-zero) integers, m and n, each less than 20, followed by a character. Output: A file containing an m × n rectangle made using the specified character. For example, if the input file contained the numbers 4 and 6 and the character ⋆ as shown below, 4 6* the output file would show 4 lines of 6 stars each, as shown below: ****** ****** ****** ******

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

This week’s assignments deal with files and nested loops.
Input: The program prompts for the name of an input file and the name of an output file. The
input file contains two positive (non-zero) integers, m and n, each less than 20, followed by a
character.
Output: A file containing an m × n rectangle made using the specified character.
For example, if the input file contained the numbers 4 and 6 and the character ⋆ as shown below,
4 6*
the output file would show 4 lines of 6 stars each, as shown below:
******
******
******
******
This program will start by opening the input file and reading the numbers and the specified charac-
ter. Thereafter a nested for loop will generate the pattern. The following questions are designed
to step you through the process of creating the nested loop.
Pre-lab component: Question 1: Using Raptor, create a flowchart for the following process:
write a specified character (denoted ch) n times on the output stream and move the cursor to the
beginning of the next line. (In Raptor, the character must be put in double quotes. When writing,
uncheck the “end current line” box to stay on the same line; write an empty string with the box
checked to go to the next line.)
Pre-lab component: Question 2: Created a nested loop in Raptor. The outer loop will run the
inner loop a specified number of times. The result will be rectangular block of characters. Example
for constructing a nested Raptor loop can be found here. Note that when you draw the nested loop
1

 
 

in Raptor, the outer loop is created first, and the inner loop is placed inside it.
Question 3: Implement your algorithm in C++ using the for loops. (See the programs in In
CourseInfo/Files/ in CourseFiles for help with opening files.) Create three sample data files. In
a script session, do the following:
1. cat the program file and compile it using g++.
2. For each data file you created, display the file, run the program and display the resulting output
file.

Expert Solution
Step 1

“Since you have asked multiple questions, we will solve the first question for you. If you want any specific question to be solved, then please specify the question number or post only that question.”

The C++ language is developed by Bjarne Stroustrup. The C++ language is used to develop system software. C++ provides different ways of programming such as functional, object-oriented, procedural, and so on.

 

trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 4 images

Blurred answer
Knowledge Booster
File Input and Output Operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education