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

bartleby

Videos

Textbook Question
Book Icon
Chapter 6, Problem 22SA

What is the output of the following program? (6)

#include <iostream> using name spacestd; void func1(); void func2(); int main() { int num; cout << "Enter 1 or 2: "; cin >> num; cout << endl; cout << "Take "; if ( num 1 ) func1() ; else if ( num 2 ) func2 (); else cout << "Invalid input . You must enter a 1 or 2" << endl; return 0; } void func1() { cout << "Programming I ." <<endl; } void func2() { cout<<"Programming II .”<<endl; }

  1. What is the output if the input is 1?

  2. What is the output if the input is 2?

  3. What is the output if the input is 3?

  4. What is the output if the input is -1?

Blurred answer
Students have asked these similar questions
In c++ only  Please create a class multiplication with three overloaded functions to multiply two or three integers or two double literels. Please provide output and code screenshot
Should define a main function and end by invoking it
PLEASE CODE THIS IN C AND NOT C++. ONLY USE IF/CASE AND USER-DEFINED FUNCTIONS. PLEASE DO NOT USE LOOPS,STRUC, AND POINTERS. PLEASE ONLY DECLARE AND CALL VARIABLES IN THE MAIN FUNCTION, EVERYTHING ELSE IS IN A DIFFERENT USER-DEFINED FUNCTION. PLS CHECK IF IT WORKS TOO.
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
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
functions in c programming | categories of function |; Author: Education 4U;https://www.youtube.com/watch?v=puIK6kHcuqA;License: Standard YouTube License, CC-BY