Problem Solving with C++ (9th Edition)
Problem Solving with C++ (9th Edition)
9th Edition
ISBN: 9780133591743
Author: Walter Savitch
Publisher: PEARSON
Question
Book Icon
Chapter 16, Problem 7PP
Program Plan Intro

  • Include required library files.
  • Define a class named “ArrOutOfRangeErr”.
  • Declare the required variables, constructors and function inside the access specifier “public” and “private”.
  • Define a “testExcep()” function to test the exception.
    • Using exception, set and get the values.
  • Define a “create2DArr()” function to create an two-dimensional array.
  • Define a “check_args()” function to check the validity and return the message if something is wrong.
  • Define a “set()” function to store values.
  • Define a “get()” function to retrieve the values.
  • Define a default constructor for no messages.
  • Define a parameterized constructor for row and column data.
  • Define a “getMsg()” function to return the exception message string.
  • Define a “getRows()” function to return the number of rows.
  • Define a “getCols()” function to return the number of columns.
  • Define a “getDesiredRow()” function to return the requested row number.
  • Define a “getDesiredColumn()” function to return the requested column number.
  • Define a “writeErr()” function to write the error message.
  • Define a “main()” function.
    • Declare the required variables.
    • Create a 2D array for rows and columns.
    • Populate the rows and columns.
    • Print the array contents using “for” loop.
    • Then test the some boundary cases.

Blurred answer
Students have asked these similar questions
The following is code for a disc golf program written in C++:   // player.h #ifndef PLAYER_H #define PLAYER_H   #include <string> #include <iostream>   class Player { private:     std::string courses[20]; // Array of course names     int scores[20];          // Array of scores     int gameCount;          // Number of games played   public:     Player();               // Constructor     void CheckGame(int playerId, const std::string& courseName, int gameScore);     void ReportPlayer(int playerId) const; };   #endif // PLAYER_H   // player.cpp #include "player.h" #include <iomanip>   Player::Player() : gameCount(0) {}   void Player::CheckGame(int playerId, const std::string& courseName, int gameScore) {     for (int i = 0; i < gameCount; ++i) {         if (courses[i] == courseName) {             // If course has been played, then check for minimum score             if (gameScore < scores[i]) {                 scores[i] = gameScore; // Update to new minimum…
In this assignment, you will implement a multi-threaded program (using C/C++) that will check for Prime Numbers and Palindrome Numbers in a range of numbers. Palindrome numbers are numbers that their decimal representation can be read from left to right and from right to left (e.g. 12321, 5995, 1234321). The program will create T worker threads to check for prime and palindrome numbers in the given range (T will be passed to the program with the Linux command line). Each of the threads works on a part of the numbers within the range. Your program should have some global shared variables: • numOfPrimes: which will track the total number of prime numbers found by all threads. numOfPalindroms: which will track the total number of palindrome numbers found by all threads. numOfPalindromic Primes: which will count the numbers that are BOTH prime and palindrome found by all threads. TotalNums: which will count all the processed numbers in the range. In addition, you need to have arrays…
How do you distinguish between hardware and a software problem? Discuss theprocedure for troubleshooting any hardware or software problem. give one reference with your answer.
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT