Write the statements as indicated by the comments

Assignment Help Computer Engineering
Reference no: EM132217476

Writing Functions that Return a Value

Summary

In this lab, you complete a partially written C++ program that includes a function that returns a value. The program is a simple calculator that prompts the user for two numbers and an operator ( +, -, *, or / ).

The two numbers and the operator are passed to the function where the appropriate arithmetic operation is performed. The result is then returned to the main() function where the arithmetic operation and result are displayed.

For example, if the user enters 3, 4, and *, the following is displayed: 3 * 4 = 12

The source code file provided for this lab includes the necessary variable declarations and input and output statements. Comments are included in the file to help you write the remainder of the program.

Instructions

Write the C++ statements as indicated by the comments.

Execute the program by clicking the "Run Code" button at the bottom of the screen.

___________________________

// Calculator.cpp - This program performs arithmetic, ( +. -, *. / ) on two numbers.

// Input: Interactive

// Output: Result of arithmetic operation

#include <iostream>

#include <string>

using namespace std;

// Write performOperation() function declaration here

int main()

{

double numberOne, numberTwo;

string operation;

double result;

cout << "Enter the first number: ";

cin >> numberOne;

cout << "Enter the second number: ";

cin >> numberTwo;

cout << "Enter an operator (+.-.*,/): ";

cin >> operation;

// Call performOperation method here

cout << numberOne;

cout << " " << operation << " ";

cout << numberTwo;

cout << " = ";

cout << result << endl;

return 0;

} // End of main() function

// Write performOperation function here

Reference no: EM132217476

Questions Cloud

Considering the market potential of clinical problem : Considering the market potential of clinical problem, what are the important factors that one should consider to evaluate the commercial feasibility of product.
Discuss any areas where you feel challenged : Social workers are expected to apply knowledge of human behavior and the social environment, person-in environment, and other multi-disciplinary theoretical.
What sort of objections can you expect : WHat sort of objections can you expect regarding implementation of Internet filters? How might you deal with such objections?
Define how the given bias impacts their clients : For citizens in some countries, religious oppression is common and long standing. While freedom of religion is guaranteed in the U.S.
Write the statements as indicated by the comments : The two numbers and the operator are passed to the function where the appropriate arithmetic operation is performed.
Management of the underwriting function : To enable candidates to understand the management of the underwriting function in an insurance organisation - Explain one significant insurance product
Would visual presentation enhance its effectiveness : How would you present the information related to this report in a visual manner? Would a visual presentation enhance its effectiveness? Why or why not?
Describe what they mean in relation to marx argument : Choose three sentences from the essay by Leo Marx that struck you as important for our understanding of technology, and describe what they mean in relation.
Create and populate an array to with the string values : Create and populate an array to with the string values of a deck of cards . Print the value of the cards to the screen proving the array has been created.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd