Answer to Question #172951 in C++ for gideon

Question #172951

A program prompts a user to enter two numbers, obtains the two numbers from the user, calculates and prints the sum, product, difference, and quotient of the two numbers.

1. Using Microsoft Word, Devise an Algorithm and Flowchart for the problem


1
Expert's answer
2021-03-18T14:00:39-0400
C++ code:


#include<iostream>
#include<string>
using namespace std;
//The start point of the program
int main (){
	float number1;
	float number2;
	//enter two numbers, obtains the two numbers from the user
	cout<<"Enter the number 1: ";
	cin>>number1;
	cout<<"Enter the number 2: ";
	cin>>number2;
	// calculates and prints the sum, product, difference, and quotient of the two numbers.
	float sum=number1+number2;
	float product=number1*number2;
	float difference=number1-number2;
	float quotient=number1/number2;
	cout<<"\nSum: "<<sum<<"\n";
	cout<<"Product: "<<product<<"\n";
	cout<<"Difference: "<<difference<<"\n";
	cout<<"Quotient: "<<quotient<<"\n\n\n";
	system("pause");
	return 0;
}


Algorithm: 


Start
	Get number 1 from the user
	Get number 2 from the user
	Calculate sum=number1+number2;
	Calculate product=number1*number2;
	Calculate difference=number1-number2;
	Calculate quotient=number1/number2;
	Display sum
	Display product
	Display difference
	Display quotient
Stop

Flowchart 


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS