Starting Out with C++: Early Objects (9th Edition)
9th Edition
ISBN: 9780134400242
Author: Tony Gaddis, Judy Walters, Godfrey Muganda
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++: Early Objects (9th Edition)
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
- 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_forward#include<iostream>using namespace std;void main(){double pi = 0, denominator = 1;int counter = 999999;for (int x = 0; x < counter; x++){if (x % 2 != 0){pi = pi - (1 / denominator);}else{pi = pi + (1 / denominator);}denominator = denominator + 2;}pi = pi * 4;cout << " So the computed value of a PI is = " << pi << endl;cout << " ";//return 0;system("pause");} Note: This a program called ComputePI to compute the value of π Tutor just have to Modify This program to use nested-if (if ... else if ... else if ... else) instead. Explain by applying a double line commentarrow_forwarddebugarrow_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_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_forwardWhat is the output of the following code?arrow_forwardidentify the syntax errors in the given code. #inclode<iostream>using name space std;int factorial(int x); int factorial(int x) ,{ if(x>1)7. return x+factorial(x-1);elsereturn 1; 10. }int main(){ for(int i=1;i<=7;i++) { 15. int fac; fac=factorial(i); cout<<"factorial of <fac<<endl; }arrow_forward#include <iostream>using namespace std; struct Person{ int weight ; int height;}; int main(){ Person fred; Person* ptr = &fred; fred.weight=190; fred.height=70; return 0;} What is a correct way to subtract 5 from fred's weight using the pointer variable 'ptr'?arrow_forward#include void main () { int a=5,b=10,c=1; if (a && b>c) { printf("cquestionbank"); } else{ break; } }arrow_forwardWhat type of parameter passing is this?arrow_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 Education
Program 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