C++ How To Program Plus Mylab Programming With Pearson Etext -- Access Card Package (10th Edition)
10th Edition
ISBN: 9780134583006
Author: Deitel
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
1-Convert the code below to OOP (Class)
2-give a detail explanation of the code
#include <iostream>
#include <cmath>
#define boardSize 15
#define boardWidth 50
// put into grid the count no of # from x,y
void putBlock(char grid[boardSize][boardWidth], int x, int y, int count)
{
for (int i = 0; i < count; i++)
grid[x][y + i] = '#';
}
// put into grid the count no of space from x,y
void putSpace(char grid[boardSize][boardWidth], int x, int y, int count)
{
for (int i = 0; i < count; i++)
if (grid[x][y + i] != '#')
grid[x][y + i] = ' ';
}
void putCircle(char grid[boardSize][boardWidth], int x, int y)
{
// line 1
putSpace(grid, x, y, 3);
putBlock(grid, x, y + 3, 5);
// line 2
putSpace(grid, x + 1, y, 1);
putBlock(grid, x + 1, y + 1, 2);
putSpace(grid, x + 1, y + 3, 5);
putBlock(grid, x + 1, y + 8, 2);
// line 3
putBlock(grid, x + 2, y, 1);
putSpace(grid, x + 2, y + 1, 9);…
Deal or No Deal?
Code in C language
#include
using namespace std;
(а)
class Fraction{
int x, y;
public:
Fraction (int a, int b) {x=a; y=b;};
int getx(){return x;}
int gety() {return y;}
} ;
int main()
Fraction n(3, 7);
++n;
cout << "x/y: " <« n.getx()<< "/" « n.gety()<
Chapter 5 Solutions
C++ How To Program Plus Mylab Programming With Pearson Etext -- Access Card Package (10th Edition)
Ch. 5 - Describe the four basic elements of...Ch. 5 - Compare and contrast the while and for iteration...Ch. 5 - Prob. 5.7ECh. 5 - Compare and contrast the break and continue...Ch. 5 - (Find the Code Errors) Find the error (s), if any,...Ch. 5 - Prob. 5.10ECh. 5 - (Find the Smallest Value) Write an application...Ch. 5 - (Calculating the Product of Odd Integers) Write an...Ch. 5 - (Factorials) Factorials arc used problems. The...Ch. 5 - (Modified Compound-Interest Program) Modify the...
Ch. 5 - (Triangle-Printing program)Write an application...Ch. 5 - (Bar- Chart Printing Program) One interesting...Ch. 5 - (Calculating Sales) An online retailer sells five...Ch. 5 - Assume thati = 1, j = 2, k = 3and m = 2. What does...Ch. 5 - (Calculate the value of ) Calculate the value of ...Ch. 5 - (Pythagorean Triples) A right triangle can have...Ch. 5 - (Modified Triangle-Printing Program) Modify...Ch. 5 - (De Morgan`s Laws)In this chapter, we discussed...Ch. 5 - (Diamond -Printing Program) Write an application...Ch. 5 - (Diamond -Printing Program) Write an application...Ch. 5 - Removing break and continue) A criticism of the...Ch. 5 - Prob. 5.26ECh. 5 - Replacing continue with a structured Equivalent)...Ch. 5 - Prob. 5.28ECh. 5 - (Peter Minuit Problem) Legend has it that, in...Ch. 5 - (Dollar Amount Constructor with Two Parameters)...Ch. 5 - (Dollar Amount Arithmetic) Enhance class Dollar...Ch. 5 - Prob. 5.32ECh. 5 - (Dollar Amount with dollars cents Data Members)...Ch. 5 - (Account Class That Stores a Dollar Amount)...Ch. 5 - (Displaying the Interest Rate in the Dollar Amount...Ch. 5 - (Showing That double Values Are Approximate)...Ch. 5 - (Global Warming Facts Quiz) The controversial...Ch. 5 - (Global Warming Facts Quiz) The controversial...Ch. 5 - (Tax Plan Alternatives: The "Fair' Tax") There are...
Knowledge Booster
Similar questions
- int mystery (int u, int v) { int a; a = u - V; u = a; V = u; return u + v; choose the output of the follos cout << mystery (9,7); Select one: a. 7 b. 4 C. 9arrow_forwardC++ OOP classesarrow_forwardPROGRAMMING LANGUAGE: C++ Add screenshots of outputs as well Execute the following example and write a comment after each line of code. In result print output of code. #include<iostream> #include<string> using namespace std; class Date {public: Date() {month=1; day=1; year=1990; } Date(int m,int d, int y) { month=m; day=d; year=y; } void set() { int d,m,y; cout<<"Enter day: "; cin>>d; cout<<"Enter month: "; cin>>m; cout<<"Enter year: "; cin>>y; month=m; day=d; year=y; } void print() { cout<<day<<"-"<<month<<"-"<<year; } private:…arrow_forward
- C programming Fill in the blanks.arrow_forward2. 1 //Program 4.2 #include #include int main () { int nilai1; nilail = 4; printf("%d+%d=%d", nilail, nilai2, nilail+nilai2); 9. getch(); 10 return 0; 11arrow_forwardoop using c++ please give me full answer thanks Write a Program that implements Base class calculator and a Derived class scientific calculator, The Derived class should take the basic operations i.e. add, divide, subtract from calculator. However it should have its own methods such as square root.arrow_forward
- 1. C++: Complete the following incomplete code to a executable C++ program): [4C Open with Google Docs class Array{ int* dataPtr; int noofElements; float avg; public: // define necessary getter and setter method (s) // define other necessary method (s) to support the main () //NO friend is ALLOWED }; class ArrayOfArrays { Array* ptrToArrays; int noofArrays; public: // define method: "setArrayofArrays" // set random integers and calculate avg to the fields for // each of ptrToArrays [i] [see RUN] // define method: "showArrayofArrays" // show elements and avg as per the RUN // define method: "getAvgofAvgs" // display the average of array-averages as per the RUN //NO friend is ALLOWED }; int main ()) { ArrayofArrays obj; int n = rand () 810, max = 100; // n = no of Array to be pointed by ptrToArrays in obj, i.e. noofArrays // max is the upper limit of random values for Array elements in dataPtr obj.setArrayOfArrays (n, max).showArrayofArrays () ; // Explanation of setArrayofArrays (n,…arrow_forwardProgramming: C languagearrow_forwardPlease help me in c++ languagearrow_forward
- int func(int a, int b) { return (aarrow_forward2. Pointer arithmetic nasties Predict what the following code will do. Write a rationale as to why the code will do what you predict. Assume that the variables i1, 12 and i3 are laid out in that order. You may run the code (on windows) if you want to double check what it does. void main() { int i1 = 1; int i2 = 2; int i3 = 3; int *p; p = &i1; *p = 0; p = &i2; p[-1] = 5; p = &i3; p++; *p = 11; printf("%d %d %d\n",i1,i2,i3); }arrow_forwardR7.30Assuming the following declarations, find the mistakes in the statements below. struct A { int m1[2]; int m2; } struct B { A a1; A* a2; int m3; } A a; B b[2]; a.b[0].a2 = a; b.b[1].m2 = 42; c.b[2].a2 = new A; d.b[0].a1.m1 = 42; e.b[1].a2->m2 = 42;arrow_forwardarrow_back_iosSEE MORE QUESTIONSarrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
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)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education