Concept explainers
Implementation of a program with typical sections
Program Plan:
Write a C++ program with a main function and the required set of statements to accomplish the following:
Write a C++ statement that includes the header file iostream
Write a C++ statement that allows you to use cin, cout, and endl without the prefix std::.
Write C++ statement(s) that declare the following variables: num1, num2, num3, and average of type int.
Write C++ statements that store 125 into num1, 28 into num2, and -25 into num3
Write a C++ statement that stores the average of num1, num2, and num3 into average
Write C++ statement(s) that output the values of num1, num2, num3, and average
Trending nowThis is a popular solution!
Chapter 2 Solutions
C Programming: From Problem Analysis to Program Design
- Computer graphicsarrow_forwardC++arrow_forward#include <stdio.h>#include <string.h> #pragma warning(disable : 4996) // compiler directive for Visual Studio only // Read before you start:// You are given a partially complete program. Complete the functions in order for this program to work successfully.// All instructions are given above the required functions, please read them and follow them carefully. // You shoud not modify the function return types or parameters.// You can assume that all inputs are valid. Ex: If prompted for an integer, the user will input an integer.// You can use only the strlen() of strings.h library to check string length. Do not use any other string functions // because you are supposed to use pointers for this homework. // **** DO NOT use arrays to store or to index the characters in the string **** // Global Macro Values. They are used to define the size of 2D array of characters#define NUM_STRINGS 4#define STRING_LENGTH 50 // Forward Declarationsvoid…arrow_forward
- 1. The C++ statement num = 1; compares the contents of the num variable to the number 1. Group of answer choices True False 2. The user can interactively terminate a program loop through the use of a Group of answer choices semicolon scope resolution operator sentinel value kryptonite 3. A do-while statement Group of answer choices automatically performs a validity check on data will always execute at least on time None may never executearrow_forwardTo use the string manipulation functions, which header file must be included in a C++ application?arrow_forwardExercise 5: Please perform in C++ Write a program that lets the user perform arithmetic operations on two numbers. Your program must be menu driven, allowing the user to select the operation (+,-, *, or /) and input the numbers. ● ● ● Furthermore, your program must consist of the following functions: Function showChoice(): This function shows the options to the user and explains how to enter data. Function add(): This function accepts two numbers as arguments and returns the O O O O Function subtract(): This function accepts two numbers as arguments and returns their difference. O Function multiply(): This function accepts two numbers as arguments and returns the product. Function divide(): This function accepts two numbers as arguments and returns the quotient. sum.arrow_forward
- For C++ Code Template: //Include statements#include <iostream>#include <string> using namespace std; //Global declarations: Constants and type definitions only -- no variables //Function prototypes int main(){ //In cout statement below substitute your name cout << "Your name" << endl << endl; //Variable declarations //Program logic //Closing program statements system("pause"); return 0;} //Function definitionsarrow_forwardC++arrow_forwardPJ 6 – Super Calculator Please write a C++ program that can perform the following 6 valid operators for 2 numbers: N1 and N2. You need to prompt the user to enter a number, an operator, and another number. To simplify your program, please declare N1, N2, and result as double-floating numbers, and operator as char. Please see the sample test below to design your application program properly. This program is a super calculator for users to enjoy. Your program must continue asking for inputs from the user. If the user enters @' as the operator, you must thank the user and then exit the program immediately. As you can see, PJ 6 is to add some more user- friendly features to the Project 5 (PJ 5) - Simple Calculator. The O valid operators for this super calculator are as follows: 1. + for addition of N1 and N2. Therefore, result = (N1 + N2). 2. - for subtraction of N2 from N1. Therefore, result = (N1 – N2). 3. * for multiplication of N1 with N2. Therefore, result = (N1 * N2). for…arrow_forward
- 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