C++ Programming: From Problem Analysis to Program Design
C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN: 9781337102087
Author: D. S. Malik
Publisher: Cengage Learning
bartleby

Concept explainers

Expert Solution & Answer
Book Icon
Chapter 12, Problem 8SA

Explanation of Solution

The program execution is explained in the in-lined comments:

#include <iostream> 

using namespace std; 

int main()  

{  

    //declares and initializes the string variables

    //str1 and str2

    string str1 = "sunny";

    string str2 = "cloudy";

    //declare string type pointer variable s1

    string *s1;

    //prints the values of str1 and str2 which 

    //are sunny and cloudy

    cout << str1 << " " << str2 << endl;

    //assign the address of the memory location of str1

    //to s1

    s...

Blurred answer
Students have asked these similar questions
C++ printSmaller is a function that accepts two int parameters and returns no value. It will print the value of the smaller one parameters. The function protoype is as follows:  void printSmaller(int num1, int num2); write the statments to read two integers and call this function to display the smaller one.
This assignment is not graded, I just need to understand how to do it. Please help, thank you! Language: C++ Given: Main.cpp #include #include "Shape.h" using namespace std; void main() {   /////// Untouchable Block #1 //////////   Shape* shape;   /////// End of Untouchable Block #1 //////////    /////// Untouchable Block #2 //////////   if (shape == nullptr) {       cout << "What shape is this?! Good bye!";       return;   }    cout << "The perimeter of your " << shape->getShapeName() << ": " <<       shape->getPerimeter() << endl;   cout << "The area of your " << shape->getShapeName() << ": " <<       shape->getArea() << endl;   /////// End of Untouchable Block #2 //////////} Shape.cpp string Shape::getShapeName() {   switch (mShapeType)    {   case ShapeType::CIRCLE:       return "circle";   case ShapeType::SQUARE:       return "square";   case ShapeType::RECTANGLE:       return "rectangle";   case…
Q5: What are the output of the following segment of C++ code: int i; i = 12; do { cout 0 );
Knowledge Booster
Background pattern image
Computer Science
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
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education