Problem Solving with C++ (10th Edition)
Problem Solving with C++ (10th Edition)
10th Edition
ISBN: 9780134448282
Author: Walter Savitch, Kenrick Mock
Publisher: PEARSON
bartleby

Concept explainers

bartleby

Videos

Textbook Question
Book Icon
Chapter 5.1, Problem 1STE

What is the output of the following program?

  #include <iostream>

  void friendly();

  void shy(int audienceCount);

  int main()

  {

  using namespace std;

  friendly();

  shy(6);

  cout << “One more time: \n”;

  shy (2);

  friendly ();

  cout << “End of program. \n”;

  return 0;

  }

  void friendly ()

  {

  using namespace std;

  cout << “Hello \n”;

  }

  void shy(int audienceCount)

  {

  using namespace std;

  if (audienceCount < 5)

  return;

  cout << “Goodbye \n”;

  }

Blurred answer
Students have asked these similar questions
I have a running code of a dining philosophers problem but it has a logic problem where it loops right after it asks how many of the philosophers are hungry thus unable to calculate how exactly the philosophers are going to eat below is the code: #include <stdio.h>#include <stdlib.h>#include <conio.h>#include <math.h>#include <string.h>     void one(void);void two(void);void exit();int tph, philname[20], howhung, hu[20], cho;//{}[] int main(void){    int i, status[10],philname[10],howhung;    printf("\n\nDINING PHILOSOPHER PROBLEM");    printf("\nEnter the total no. of philosophers: ");    scanf("%d",&i);    for(i=0;i<tph;i++)        {            philname[i] = (i+1);            status[i]=1;        }        printf("How many are hungry : ");        scanf("%d", &howhung);        if(howhung==tph)            {                printf("\nAll are hungry..\nDead lock stage will occur");                printf("\nExiting..");            }    else        {…
Can anyone debug this?#include <iostream>using namespace std;class Employee {   public:    string name;    int status;    double salary;    double d_salary;    int days;       void getInfo(){        cout<<"Input the following data: "<<endl;        cout<<"Employee's name: ";        getline(cin,name);        cout<<"Employee's status: ";        cin>>status;               }       void display() {        cout<<endl<<"Employee's Information"<<endl<<endl;        cout << "Employee Name: " << name<<endl;        if (status ==1){            cout << "Employee Status: Regular" <<endl;        else            cout << "Employee Status: Contractual" <<endl;            }     double displaySalary() {        cout << "Annual Salary : " <<salary;     }}; class Regular : public Employee {      public:    double m_salary;        void displayTitle(){        cout<<"Enter the details of the…
What will be the output of the following program in C++? #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();}

Chapter 5 Solutions

Problem Solving with C++ (10th Edition)

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
Control Structure in Data Structure - Data Structures - Computer Science Class 12; Author: Ekeeda;https://www.youtube.com/watch?v=9FTw2pXLhv4;License: Standard YouTube License, CC-BY