Concept explainers
Show the output of the following code:
Give the output of a C++ code.
Program Plan: To give the output for the given lines of code:
double area=5.2;
cout <<"area";
cout<
Program Description:
In the given code, a double type variable is assigned the value, 5.2. There are two cout statements. The first cout statement has a string “area� and the second cout statement will
print the value stored in the variable area.
Therefore, the program output will be:
area5.2
Explanation of Solution
Program:
#include
using namespace std;
//Main of the code
int main()
{
//double type variable to store area
double area=5.2;
//cout statement that prints the message “area�
cout <<"area";
//printing the value stored in the variable area
cout<
return 0;
}
Want to see more full solutions like this?
Chapter 2 Solutions
Introduction to Programming with C++
Additional Engineering Textbook Solutions
Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)
Elementary Surveying: An Introduction To Geomatics (15th Edition)
Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)
Starting Out with Python (4th Edition)
Database Concepts (8th Edition)
- #include <stdio.h> int main(){printf(" enter two integers and ill add them \n"); int integer1;int integer2; scanf("%d,%d",&integer1, &integer2); int sum;sum = integer1+integer2; printf("sum is %d\n", sum); return 0; } when i run this code the sum is incorrect like when i type in 44 55 it says the sum is 109. whats wrong with the code?arrow_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_forward8. Determine the value of variable num1, num2 and num3 at the end of the following code. int product(int A, int *B){ *B += 1; A *= *B; return A; } int main(){ int num1 = 2, num2 = 3, num3; num3 = product(num2, &num1); O A. num1 = 3, num2 = 3, num3 = 9 num1 = 2, num2 = 3, num3 = 9 num1 = 2, num2 = 3, num3 = 6 %3D D. num1 = 3, num2 = 2, num3 = 6 B.arrow_forward
- #include using namespace std; int main() int x=1,y=2; for (int i=0; i<3; i++) e{ x=x*y; 8{ } cout<arrow_forwarddraw flow char for this code is easy 2 #include 3- int main() { 4 char c; 5 6 7 8 9 ▾ 10 11 12 13 14 15 16 17 18 19 20 21 22 23 } printf("Enter a character: "); scanf("%c", &c); // Convert Lowercase to uppercase and vice versa if (c >= 'a' && c = 'A' && c <= 'Z') { c = c + 32; // Convert uppercase to Lowercase } 2. Write a C program that ask the user to enter a character then the program will print the input character and the next characters in ascending order up to character 'Z'. (Note: if the user enters lower case character, the program will print lower case character and vice versa) } // Print the character and subsequent characters in ascending order while (c <= 'Z') { printf("%c ", c); C++; 32; // Convert Lowercase to uppercase printf("\n"); return 0; Enter a character: v V W X Y Z inputarrow_forwardPlease do in C++ coding please Nrite a program to fulfill the following requirements: You need a program to help you plan a garden. The user will enter - The square footage of their garden plot - Their needs for each of several types of plants (you won't know ahead of time how many types). For each plant they will specify the length of the rows, their width, and the number of rows. After each plant is entered, the program is to calculate the square footage used for that plant and display the remaining square footage left in the garden. The program should then ask them if they want to plant something else. If the user tries to enter too much for a plant compared to what is left, the program should tell them of their error and tell them the square footage that will actually be used for that plant. The user is not required to fill their garden space. When the user is done entering plants, the program should display the total square footage used, the number of plant types and the amount of…arrow_forwardarrow_back_iosSEE MORE QUESTIONSarrow_forward_ios
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:Cengage