STARTING OUT WITH C++ MPL
9th Edition
ISBN: 9780136673989
Author: GADDIS
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Textbook Question
Chapter 2.15, Problem 2.26CP
What is wrong with the following
#includa <iostream>
using namespace std;
int nain()
{
critter = 62.7;
double critter;
cout << critter << endl;
return 0;
}
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
What is wrong in the following code?
#include<iostream>
using namespace std;
class Box
{
Public:
int length, width, sum, sub, div;
Box (int a; int b)
{
length=a;
width=b;
}
Box (Box & A){
A.sum=A.length+A.width;
A.sub=A.length-A.width;
A.div=A.length/A.width;
}
};
int main(){
Box myBox1(10,20);
Box myBox2(myBoox1);
//cout<<"Sum="<<myBox1.Sum<<endl;
//cout<<"Sub="<<myBox1.Sub<<endl;
//cout<<"div="<<myBox1.div<<endl;
return 0;
}
Question:
On this codding and pic both are same code. this code have a constructor error, and I can't understand & I didn't find it. Solve it please sir.
This code ans is :
sum= 30
sub= -10
div= 0
نقطة واحدة
Let A = {a; b; c; d} and R= {(a; a); (b; c); (c; b); (d; d)} then R is
Transitive
Equivalent
not transitive
Chapter 2 Solutions
STARTING OUT WITH C++ MPL
Ch. 2.1 - The following C++ program will not compile because...Ch. 2.1 - On paper, write a program that will display your...Ch. 2.3 - Prob. 2.3CPCh. 2.3 - What output will the following lines of code...Ch. 2.3 - On paper, write a program that will display your...Ch. 2.5 - Which of the following are legal C++ assignment...Ch. 2.5 - List all the variables and literals that appear...Ch. 2.5 - When the above main function runs, what will...Ch. 2.5 - When the following main function runs, what will...Ch. 2.7 - Which of the following are illegal C++ variable...
Ch. 2.7 - Prob. 2.11CPCh. 2.7 - Prob. 2.12CPCh. 2.7 - Prob. 2.13CPCh. 2.7 - How would you combine the following variable...Ch. 2.7 - How would you combine the following variable...Ch. 2.8 - Prob. 2.16CPCh. 2.8 - What will the following code display? int number;...Ch. 2.8 - Prob. 2.18CPCh. 2.10 - Prob. 2.19CPCh. 2.10 - Which of the following is a character literal? 'B'...Ch. 2.10 - Prob. 2.21CPCh. 2.10 - What is wrong with the following program...Ch. 2.10 - Prob. 2.23CPCh. 2.10 - Write a program that stores your name, address,...Ch. 2.15 - Is the following assignment statement valid or...Ch. 2.15 - What is wrong with the following program? How...Ch. 2.15 - What will be assigned to x in each of the...Ch. 2.15 - Prob. 2.28CPCh. 2 - Every complete statement ends with a _____.Ch. 2 - To use cout statements you must include the _____...Ch. 2 - Every C++ program must have a function named...Ch. 2 - Prob. 4RQECh. 2 - A group of statements, such as the body of a...Ch. 2 - 'A', and "Hello World" are all examples of _____.Ch. 2 - 978.65 1012 would be written in E notation as...Ch. 2 - Prob. 8RQECh. 2 - Indicate if each of the following assignment...Ch. 2 - If the variables letter and w have been defined as...Ch. 2 - Indicate if each of the following cout statements...Ch. 2 - Indicate if each of the following cout statements...Ch. 2 - Assume integers x = 4, y = 7, and z = 2. What...Ch. 2 - Assume double variables x = 2.5, y = 7.0, and z =...Ch. 2 - Write a C++ statement that defines the double...Ch. 2 - Write a C++ statement that defines the int...Ch. 2 - Write assignment statements that perform the...Ch. 2 - Write assignment statements that perform the...Ch. 2 - Modify the following program segment so it prints...Ch. 2 - Rewrite the follow statement to use the newline...Ch. 2 - Create detailed pseudocode for a program that...Ch. 2 - Prob. 22RQECh. 2 - Prob. 23RQECh. 2 - Create detailed pseudocode for a program that...Ch. 2 - What will the following programs print on the...Ch. 2 - A) #include iostream using namespace std; int main...Ch. 2 - The following program contains many syntax errors....Ch. 2 - Soft Skills Programmers need good communication...Ch. 2 - Sum of Two Numbers Write a program that stores the...Ch. 2 - Sales Prediction The East Coast sales division of...Ch. 2 - Sales Tax Write a program that computes the total...Ch. 2 - Restaurant Bill Write a program that computes the...Ch. 2 - Miles per Gallon A car holds 16 gallons of...Ch. 2 - Distance per Tank of Gas A car with a 20 gallon...Ch. 2 - Number of Acres One acre of land is equivalent to...Ch. 2 - Land Calculation In the United States, land is...Ch. 2 - Circuit Board Price An electronics company makes...Ch. 2 - Prob. 10PCCh. 2 - Triangle Pattern Write a program that displays the...Ch. 2 - Diamond Pattern Write a program that displays the...Ch. 2 - Pay Period Gross Pay A particular employee earns...Ch. 2 - Basketball Player Height The star player of a high...Ch. 2 - Stock Loss Kathryn bought 750 shares of stock at a...Ch. 2 - Energy Drink Consumption A soft drink company...Ch. 2 - Past Ocean Levels The Earths ocean levels have...Ch. 2 - Future Ocean Levels During the past decade ocean...Ch. 2 - Annual High Temperatures The average July high...Ch. 2 - How Much Paint A particular brand of paint covers...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
Combine the statements that you wrote in Exercise 4.5 into a Java application that calculates and prints the su...
Java How To Program (Early Objects)
From Programming Project 10 in Chapter 1, scientists estimate that roughly 10 grams of caffeine consumed at one...
Absolute Java (6th Edition)
Write a for statement that displays the even numbers 2, 4, 6, 8, and 10. Each number should appear on a separat...
Java: An Introduction to Problem Solving and Programming (7th Edition)
What populates the Smalltalk world?
Concepts of Programming Languages (11th Edition)
Hot Dog Cookout Calculator Assume hot dogs come in packages of 10, and hot dog buns come in packages of 8. Writ...
Starting Out with Python (4th Edition)
Describe what LIFO means.
Starting Out with C++ from Control Structures to Objects (8th Edition)
Knowledge Booster
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
- 3: The code on the right is supposed to be the ARM code for procA; however, there are problems with the ARM code. C code: int procA(int x, int y) { int perimeter = (x + y) * 2; I return perimeter; } ARM code: I procA: add rø, r1, r2 mov r1, rø lsl #1 bx lr push {lr} Give the corrected version of the ARM code for procA:arrow_forwardc++ coding language I need help with part B and C please. If you are unable to do both, then PLEASE prioritize part C. I am really stuck and really can use the help. This is the code for c that was provided in order to guide me: const int N =31; // N parking spaces bool parking[N]; // the garage void EmptyTheLot(bool parking[], int N) { for(int i=0; i<N; i++) p[i]=false; // empty space } // returns -1 if no space found, //otherwise it returns 0<=i<N for a valid space. int FindSpace(int PlateNumber, bool parking[], int N) { // ????? } main() { EmptyTheLot(parking, N); // start with an empty parking garage. // get plate numbers and fill lot. }arrow_forward#include using namespace std; void some_action_1(int); int main() { cout<arrow_forward#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()<arrow_forwardHello, I was making a hangman simulation in C++. The code runs, but not fully. Could you identify the error and fix it? #include<iostream>#include<cstring> // for string class functions#include<fstream>#include <cctype>using namespace std; int main(){// define variable to get the response from user "Yes" or "No"string response;// Define index variableint w = 0;// define number of words that need to be guessed by the user assume 4const int WORDS = 4;// loopdo{// we will define the hangman bodyconst char body[] = "o/|\\|\\";// here we define the wordsstring words[WORDS] = {"MACAW", "SADDLE", "TOASTER", "XENOICIDE"};// fetch size or lengthstring xword(words[w].length(),'*');// define iterator to fetch the wordsstring::iterator i, ix = xword.begin();// define number of words to prompt for the userchar letters[26]={"\0"};// Now we define the variables which will be used in the simulationint n =0, xcount = xword.length();bool found = false, solved = false, hung =…arrow_forwardHello, I was making a hangman simulation in C++. The code runs, but not fully. Could you identify the error and fix it? #include<iostream>#include<cstring> // for string class functions#include<fstream>#include <cctype>using namespace std; int main(){// define variable to get the response from user "Yes" or "No"string response;// Define index variableint w = 0;// define number of words that need to be guessed by the user assume 4const int WORDS = 4;// loopdo{// we will define the hangman bodyconst char body[] = "o/|\\|\\";// here we define the wordsstring words[WORDS] = {"MACAW", "SADDLE", "TOASTER", "XENOICIDE"};// fetch size or lengthstring xword(words[w].length(),'*');// define iterator to fetch the wordsstring::iterator i, ix = xword.begin();// define number of words to prompt for the userchar letters[26]={"\0"};// Now we define the variables which will be used in the simulationint n =0, xcount = xword.length();bool found = false, solved = false, hung =…arrow_forward#include <iostream> using namespace std; class Test { static int x; public: Test() { x++; } static int getX() {return x;} }; int Test::x = 0; int main() { cout << Test::getX() << " "; Test t[5]; cout << Test::getX(); } Is the given code is correct or not.arrow_forwardPlease explain the code below #include <cstdio> #include <math.h> using namespace std; int main ( ) { // radius const int RAD = 10; // tolerance const int TOL = 5; for(int x = -RAD; x <= RAD; x++){ for(int y = -RAD; y <= RAD; y++){ int eq = x*x + y*y - RAD * RAD; printf(abs(eq) < TOL ? "*" : " "); printf(abs(eq) < TOL ? "*" : " "); } for(int y = -RAD+4; y <= RAD; y++){ int eq = x*x + y*y - RAD * RAD; printf(abs(eq) < TOL ? "*" : " "); printf(abs(eq) < TOL ? "*" : " "); } for(int y = -RAD+4; y <= RAD; y++){ int eq = x*x + y*y - RAD * RAD; printf(abs(eq) < TOL ? "*" : " "); printf(abs(eq) < TOL ? "*" : " "); } for(int y = -RAD+4; y <= RAD; y++){ int eq = x*x + y*y - RAD * RAD; printf(abs(eq) < TOL ? "*" : " ");…arrow_forwardVoid Do1 (int: &, a. int &b) { a = 5; a = a + b; b = a + 2; } Int main() { Int x = 10; Do1 (x,x); Cout << x << endl; } The output of this program isarrow_forwardGive resultarrow_forwardarrow_back_iosSEE MORE QUESTIONSarrow_forward_iosRecommended 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 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:PEARSONC 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 EducationProgram to find HCF & LCM of two numbers in C | #6 Coding Bytes; Author: FACE Prep;https://www.youtube.com/watch?v=mZA3cdalYN4;License: Standard YouTube License, CC-BY