Problem Solving with C++ (10th Edition)
Problem Solving with C++ (10th Edition)
10th Edition
ISBN: 9780134448282
Author: Walter Savitch, Kenrick Mock
Publisher: PEARSON
Question
Book Icon
Chapter 7.4, Problem 20STE
Program Plan Intro

Purpose of given code:

The purpose of given code is to store the values in multidimensional array and print these values.

Given code:

/*Include the appropriate headers*/

#include<iostream>

using namespace std;

//Main method

int main()

{

/*Declaration of variables*/

int myArray[4][4], index1, index2;

/*Loop for rows*/

for (index1 = 0; index1 < 4; index1++)

/*Loop for columns*/

for (index2 = 0; index2 < 4; index2++)

/*Assign the values into array*/

myArray[index1][index2] = index2;

/*Loop for rows*/

for (index1 = 0; index1 < 4; index1++)

{

/*Loop for columns*/

for (index2 = 0; index2 < 4; index2++)

/*Print statement with values*/

cout << myArray[index1][index2] << " ";

//Print statement

cout << endl;

}

}

Blurred answer
Students have asked these similar questions
Create a Database in JAVA OOP that saves name of the player and how many labyrinths did the player solve. Record the number of how many labyrinths did the player solve, and if he loses his life, then save this number together with his name into the database. Create a menu item, which displays a highscore table of the players for the 10 best scores. Also, create a menu item which restarts the game. public class GameGUI extends JPanel {    private final Labyrinth labyrinth;    private final Player player;    private final Dragon dragon;     private void checkGameState() {        if (player.getX() == 0 && player.getY() == labyrinth.getSize() - 1) {            JOptionPane.showMessageDialog(this, "You escaped! Congratulations!");            System.exit(0);        }         if (Math.abs(player.getX() - dragon.getX()) <= 1 &&            Math.abs(player.getY() - dragon.getY()) <= 1) {            JOptionPane.showMessageDialog(this, "The dragon caught you! Game Over.");…
Change the following code so that the player can see only the neighboring fields at a distance of 3 units.   public class GameGUI extends JPanel {    private final Labyrinth labyrinth;    private final Player player;    private final Dragon dragon;     private final ImageIcon playerIcon = new ImageIcon("data/images/player.png");    private final ImageIcon dragonIcon = new ImageIcon("data/images/dragon.png");    private final ImageIcon wallIcon = new ImageIcon("data/images/wall.png");    private final ImageIcon emptyIcon = new ImageIcon("data/images/empty.png");     public GameGUI(Labyrinth labyrinth, Player player, Dragon dragon) {        this.labyrinth = labyrinth;        this.player = player;        this.dragon = dragon;         setFocusable(true);        addKeyListener(new KeyAdapter() {            @Override            public void keyPressed(KeyEvent e) {                char move = switch (e.getKeyCode()) {                    case KeyEvent.VK_W -> 'W';                    case…
Q/ Fill in the table below with the correct answers for the network devices and components required, then draw the topology diagram for the network of this three-story building: I want a drawing Cisco Packet tracer Ground Floor: This floor will house the main server room, reception area, and a few conference rooms. The server room should contain the core network devices that will connect the entire building. The reception area and conference rooms need network access require access for mobile devices for visitors and guests with devices. First Floor: This floor is dedicated to offices with workstations, each needing reliable network connectivity for staff computers, IP phones, IP camera, and printers. Second Floor (Education Department): This floor consists of educational spaces requiring controlled internet access. Only the educational website (https://uokerbala.edu.iq) should be accessible, with all other sites restricted.. Device Media type Location floor Type of IP Static/dynamic…

Chapter 7 Solutions

Problem Solving with C++ (10th Edition)

Ch. 7.2 - Consider the following function definition: void...Ch. 7.2 - Prob. 12STECh. 7.2 - Write a function definition for a function called...Ch. 7.2 - Consider the following function definition: void...Ch. 7.2 - Insert const before any of the following array...Ch. 7.2 - Write a function named outOfOrder that takes as...Ch. 7.3 - Write a program that will read up to ten...Ch. 7.3 - Write a program that will read up to ten letters...Ch. 7.3 - Following is the declaration for an alternative...Ch. 7.4 - Prob. 20STECh. 7.4 - Write code that will fill the array a (declared...Ch. 7.4 - Prob. 22STECh. 7 - Write a function named firstLast2 that takes as...Ch. 7 - Write a function named countNum2s that takes as...Ch. 7 - Write a function named swapFrontBack that takes as...Ch. 7 - The following code creates a small phone book. An...Ch. 7 - There are three versions of this project. Version...Ch. 7 - Hexadecimal numerals are integers written in base...Ch. 7 - Solution to Programming Project 7.3 Write a...Ch. 7 - Prob. 4PPCh. 7 - Write a program that reads in a list of integers...Ch. 7 - Prob. 6PPCh. 7 - An array can be used to store large integers one...Ch. 7 - Write a program that will read a line of text and...Ch. 7 - Write a program to score five-card poker hands...Ch. 7 - Write a program that will allow two users to play...Ch. 7 - Write a program to assign passengers seats in an...Ch. 7 - Prob. 12PPCh. 7 - The mathematician John Horton Conway invented the...Ch. 7 - Redo (or do for the first time) Programming...Ch. 7 - Redo (or do for the first time) Programming...Ch. 7 - A common memory matching game played by young...Ch. 7 - Your swim school has two swimming instructors,...Ch. 7 - Your swim school has two swimming instructors,...Ch. 7 - Prob. 19PPCh. 7 - The Social Security Administration maintains an...
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
New Perspectives on HTML5, CSS3, and JavaScript
Computer Science
ISBN:9781305503922
Author:Patrick M. Carey
Publisher:Cengage Learning