Write a C++ program that promotes the user to enter 2 double values, then ask the user to enter a mathematical sign either ‘+' or ‘-‘ or ‘x' or ‘/'. Based on the input sign, the program should perform the corresponding mathematical operation and print the result.

Answers

Answer 1

Answer:

#include<iostream>

using namespace std;

int main(){

double num1, num2;

char ope;

cout<<"Enter two numbers: ";

cin>>num1>>num2;

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

cin>>ope;

if(ope == '+'){

cout<<num1+num2;}

else if(ope == '-'){

cout<<num1-num2;}

else if(ope == '*'){

cout<<num1*num2;}

else if(ope == '/'){

cout<<num1/num2;}

else{

cout<<"Invalid operator";}

return 0;

}

Explanation:

#include<iostream>

using namespace std;

int main(){

This line declares num1 and num2 as double

double num1, num2;

This line declares ope as a character

char ope;

This line prompts user for user inputs

cout<<"Enter two numbers: ";

This line gets user inputs

cin>>num1>>num2;

This line prompts user for operator

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

This line gets the operator

cin>>ope;

This condition checks if the operator is +. If yes, it adds and prints the result

if(ope == '+'){

cout<<num1+num2;}

This condition checks if the operator is -. If yes, it subtracts and prints the result

else if(ope == '-'){

cout<<num1-num2;}

This condition checks if the operator is *. If yes, it multiplies and prints the result

else if(ope == '*'){

cout<<num1*num2;}

This condition checks if the operator is /. If yes, it divides and prints the result

else if(ope == '/'){

cout<<num1/num2;}

This checks for invalid operators

else{

cout<<"Invalid operator";}

return 0;

}


Related Questions

Mandy is writing a paragraph about her favorite basketball team. She wants to explain that the team is so successful because the players work together. What would be the best type of evidence to illustrate Mandy’s proposed topic? a few examples of how the players successfully scored points a brief history of the game of basketball a quotation from the coach about the players a comparison of current players with past successful members of the team

Answers

Answer:

A ) a few examples of how the players successfully scored points

edge 2021 :)

Answer: (A)

Explanation: Just got it right.

What is not a way to lower your risk of drowsy driving?

Answers

Answer:

Taking a night time medicince (such as benedryl), or drinking alcohol beofre drviving.

Explanation:

Brainliest please :)

need help asap plzz can you take advantage of the information on social media sites related to careers you are interested in

Answers

Answer:

(The social media site which lets you earn money) lets you post any contents as long as it follow the rules. The advantage information about (The socia media mentioned earlier)is that you can earn money, for making what you want.

Explanation:

fill in the blanks

Select the correct text in the passage.

Which phrase is noise in the process of communication?

Ben wanted to call his friend Kevin for a game of football. He rang up Kevin and was about to mention the game. Just then, a car nearby honked loudly. Kevin said that he couldn’t hear what Ben said. Ben then repeated what he had said earlier.

Answers

Answer:

The answer to this question is given below in the explanation section.

Explanation:

As you know that noise distracts the process of communication. It is anything that distorts a message between two communicators. Noise can take many forms, such as playing the radio in the background, another person interfering with the conversation, and any other distraction that prevent the receiver from paying attention to what the sender is saying.

So, in this question, the noise phrase in the given passage is written in bold.

Ben wanted to call his friend Kevin for a game of football. He rang up Kevin and was about to mention the game. Just then, a car nearby honked loudly. Kevin said that he couldn’t hear what Ben said. Ben then repeated what he had said earlier.

A car honked nearly when Ben and Kevin are communicating with each other is considered noise. A car honked is a noise in the process of communication.    

Answer:

Just then, a car nearby honked loudly.

Explanation:

PLATO

Now that he is employed, Martin wants to start making plans to purchase a new home. Martin's plan to save up for a down payment within 1 to 5 years is an example of a(n) __________-term goal. Group of answer choices

Answers

Answer:

long term goal

Explanation:

A long-term goal is an achievable a person seeks to accomplish within a certain period of time, typically in years. A series of short-term goals can sum up to a long-term goal. Martin's down payment plan to get a loan on a house within 5 years is a long term goal

100 points, PLEASE HELP...To generate numbers between and including -10 to 10 you would use:

Answers

Answer:

A number line?

What will happen when you run this program?

num = 10
while num > 0:
print (num)

a Syntax Error
b Logical fallicy
c Infinite loop
d Definite loop

Answers

Answer:

C. Infinite loop

Explanation:

num will be printed continuously since it will always be bigger than [tex]0[/tex] ([tex]10[/tex] is greater than [tex]0[/tex], satisfying the condition num > 0) making it an infinite loop since it will go on forever.

Hope this helps :)

Which options are qualities of all good requirements documents?
Consistent
llustrated
verifiable
printed
scholarly
feasible

Answers

consistent
feasible
scholarly
verifiable

print("Student" == "Teachers" or 99 != 88) will output False

true or false

Answers

Answer:

it will output True, so the statement is false

Explanation:

Explain the process of creating a switch statement to replace an if-then-else statement in Java.

Answers

Answer:

The answer to this question is given in the explanation section.

Explanation:

Let look at an if the else statement

if (condition1) {

 //some code if condition 1 is true

} else if (condition2) {

 // some code if condition 2 is true

} else {

 // some code if condition 3 is true

}

No let look at switch statement

switch(expression) {

 case x:

   // code block

   break;

 case y:

   // code block

   break;

 default:

   // code block

Now let look at your answer.

if then else should be replaced with switch if conditions are fixed.

in the process of replacing

write your condition of if statement  in the case area of swatch

Answer:

The answer to this question is given in the explanation section.

Explanation:

Let look at an if the else statement

if (condition1) {

//some code if condition 1 is true

} else if (condition2) {

// some code if condition 2 is true

} else {

// some code if condition 3 is true

}

No let look at switch statement

switch(expression) {

case x:

  // code block

  break;

case y:

  // code block

  break;

default:

  // code block

Now let look at your answer.

if then else should be replaced with switch if conditions are fixed.

in the process of replacing

write your condition of if statement  in the case area of swatch

The pins on the temperature sensor are connected to;

Answers

A temperature sensor creates a changing voltage signal depending on the temperature it senses. It has three pins: one that connects to ground, another that connects to 5 volts, and a third that outputs a variable voltage to your Arduino, similar to the analog signal from a potentiometer.

what are the difference between of panchayat and multi party system​

Answers

Answer:

The parties in a multi-party system can control government separately or as a coalition; in a two-party system, however, coalition governments rarely form.

Traditionally Panchayats consisted of elderly and wise people chosen by the local community, who used to settle disputes between individuals and villages. The leader of the panchayat used to be called as Mukhiyas or Sarpanch.

Explanation:

Which type of game is based on doing the best you can with a random setup, emphasizing flexible planning and risk-
taking?
A:card games
B:board games
C:dice games
D:all games
PLSSS PLSSS HELP MEEE

Answers

Answer:

Card Games

You get completely random cards, so you have to plan as you go.

Answer:

A. card games

Select all the correct answers.

Which two statements about resistors are true?

1. Series resistors produce a lower resistance than the same parallel resistors.
2. Resistors impede the current flowing through a circuit.
3. Resistors increase the voltage through a circuit.
4. Series resistors produce a higher resistance than the same parallel resistors.
5. Parallel resistors allow more current to pass through than no resistors.

Answers

Explanation: 2 and 5

Answer:

resistors reduce current flow and divide voltages, so 2 & 3!

WILL GIVE BRAINLIEST!! 20 PNTS!!!

What will be the output of these lines of code:

for i in range (1, 5):

print(i)

A. IndentationError

B. PrintError


C. 1 2 3 4


D. 1 2 3 4 5

Answers

Answer:

C 1,2,3,4

Explanation:

This means I want to count from 0-4 and set it o the current loop I am currently on.

for i in range(0, 5):

 print("i currently equals: ", i)

The result will be

i currently equals: 0

i currently equals: 1

i currently equals: 2

i currently equals: 3

i currently equals: 4

Answer:

c. 1 2 3 4

Explanation:

i got it right on edge

When code is compiled it
A) is read directly from the program.
B)is made into a smaller version.
C) runs slower.
D) is converted into binary code.

Answers

Answer:

A compiler takes the program code (source code) and converts the source code to a machine language module (called an object file). Another specialized program, called a linker, combines this object file with other previously compiled object files (in particular run-time modules) to create an executable file. In short, it's A or D.

Answer:

D - is coverted to binary code

Explanation:

A compiler takes the program code (source code) and converts the source code to a machine language module (called an object file). Another specialized program, called a linker, combines this object file with other previously compiled object files (in particular run-time modules) to create an executable file.

WILL GIVE BRAINLIEST! 20 POINTS! PLZ HELP!

What does the following line of code do?

if (num2==50){

A. It creates a variable called num2 and sets it equal to 50.

B. It checks whether a variable called num2 is equal to 50.

C. It prints num2 == 50.

D. It requests user input if the variable num2 is equal to 50.

Answers

Answer:

B

Explanation:

== returns true if both the left side and right side are equal

Answer:

D

Explanation:

pls help IM BEGGING U ITS 10 POINTS PLS

For months, Aida and her three closest friends hod been waiting for a new movie to come out. The movie was
based on one of their fovorite books, ond they promised they would see it all together and then go out fpr
plzza. On the movie's opening weekend, Aida had a lost minute emergency ond wasn't able to go. The others
decided to go anyway becouse they had really been looking forwad to it. That night they posted costantly
about their fun ond new inside jokes. Aida wonted to keep connected, but seeing the constant posts bummed
her out. She felt like no one even cared that she had missed out on their plans.


Imagine: Imagine how the situation could be handled. Come up with as many ideas as
possible: There's no one "right" answer! Then, highlight which option might lead to the most
positive outcome, where most people feel good or taken care of.

Answers

Answer:

It's your Opinion/Decision.

Explanation:

In general, her group of friends could've been considerate people, and should have remembered that she couldn't go and NOT posted about it, and tell her about it the next time they met up.

Where would you go to access frequently used icons?

File explorer
File manager
Toolbar
Web browser

Answers

Answer:

b

Explanation:

Answer:

C.) Toolbar

Explanation:

The toolbar is a strip of icons that are frequently used.

only true naruto fans know
who is behide the mask in akatsuki
A madara
B Sasuke
C Obito
D Ten tails

Answers

Answer:

obito duh, its Tobi the orange masked one he acts like madara but we know it's his simp guy

Answer:

Obito

Explanation:

cuz obito

The Danger zone around a robot is?

Answers

maybe a EMP. tell me if im right

Answer:

the area the robot can reach or the work envelope and where all the robots tasks takes place. ... OSHA, the system had an E-stop on it to shut down the robot if needed

What is the definition of bug?​

Answers

In what way is it used?

Complete the following sentence.
Some manufactured dams produce BLANK power in addition to retaining water.

Answers

Answer:

Some dams produce renewable hydroelectric power  

Explanation:

hydroelectric is power from water

Answer:

hydroelectric

Explanation:

The correct answer is hydroelectric. Dams are structures created to serve as a barrier and to retain water. Some dams are also used to produce hydroelectric power.

______means to set a variable equal to a known value before a
loop.
A. Initialize
B. Sum
C. Output
D. Input

Answers

A. initialize

I hope this helped!

I would appreciate it if you gave me a thanks and brainliest (:

What are like arms surrounding all the other code blocks?
A. chevrons
B. curly braces
C. square braces
D. parentheses

Answers

Answer:

Parenthesis

Explanation:

I code

Answer:

Its curly braces.

Your welcome!

can someone help me?

Answers

Answer:

2nd one

Explanation:

Answer:

A

Explanation:

3*6+2/2 = 19

(3*6)+2/2 = 19

3*(6+2/2) = 21

Which one do u prefer Xbox, Playstation, Nintendo ​

Answers

Mobile And PC Gaming

A large corporation uses:
A.
LAN
B.
WAN
C.
Wireless network
D.
Ethernet connection

Answers

Answer:

WAN

but im saying this bc you cant mark brainliest with only 1 answer there

Answer:

B: WAN

Explanation:


Activity
You have learned about the graphical elements that you can add in a spreadsheet. Create your own spreadsheet using these elements.
Question 1
Create a chart using the sample data in the table below. Recollect the steps on how to create a chart, and explain the necessary steps based on
the data in the table. Mention what the x- and the y-axes state and your interpretation of the data represented in the chart.
Year Percentage Increase in Expenses
2005
25.3
2007
30
2009
35
2011
35.8
2014
40

please help

Answers

Answer:

its a

Explanation:

the answer is a i am right

Answer:

Here are the steps I followed to create the chart on the Microsoft Excel spreadsheet.

I clicked the Insert option from the top toolbar.

I clicked the Chart option.

I clicked Chart Type, and selected the type of chart I wanted. The table above provides data on the increase in percentage of expenses over the years. I chose the Column chart to display this data graphically. The column chart is the best form of chart that can show variation between items.

I selected the Data Range. I specified the start and end values of the data set that I wanted to plot in the chart.

Under Chart Elements, I specified the title and legend for the chart. A legend makes it easy for a viewer to understand a titled graph.

The x-axis represents the year in my column chart, and the y-axis shows the percentage increase in expenses per year. With the help of this chart, I could see that every year the percentage in expenses has increased steadily, and reached the highest value in 2014.

Explanation:

This is really close to the sample answer, so I would be careful...

WILL GIVE BRAINLIEST!!! 15 POINTS!! HELPPPP!!

Tonya wants to add a button to a webpage. Which language should be used?

A. Python

B. HTML

C. JavaScript

D. CSS

Answers

Answer:

B and C both will be right answers

Answer:

B and C are both correct answers

Explanation:

Other Questions
George Washington was chosen commander of the continental army upon the recommendation of Place a checkmark next to each of Lennie's physical characteristics: Why was the american revolution unique? Can someone help me? true or false eliminating waste from the body is a function of the digestive system PLZ HELP You are writing a letter to your grandmother telling her about what different people in your family need, want, and have to do this week. Your response should consist of at least five sentences. Can someone please help me . WIL MARK BRAINLIEST !! What's your thoughts on the United States Military Solve:7/8 - (-1/8)A. -1B. -1/8C. 1/8D.1 A train is traveling at a constant speed and goes a distance of 7 1/2 kilometers in 6 minutes the train will continue at this speed the train will travel a distance of d kilometers in m minutes write an equation that represents the relationship between d and m Why were Samaritans disliked by the Jews at the time? HELPP ME PLEASEEE!!!Pretrito o Imperfecto? Complete los espacios en blanco con la forma correcta. Usa los acentos cuando sea necesario. Cuando nosotros 1(ir) ____________ a Mexco el mes pasado, 2(visitar) ____________ un parque que 3 (tener) ____________ unas flores maravillosas. 4(Haber) ____________ un grupo de jvenes que 5(buscar) ____________ el lugar donde 6(estar) ____________ el dios del agua.Yo les 7(preguntar) ____________ que ellos 8(hacer) ____________ y me 9(decir) ____________ que 10(ser) ____________estudiantes de ciencias naturales. 11(Haber) ____________ una seora en el grupo que 12(ser) ____________mayor y nos 13(decir) ____________ a nosotros que ella 14(ser) ____________ la profesora. Ellos 15(venir) ____________ a Mxico porque all 16(poder) ____________ estudiar mejor las plantas. El grupo 17(estar) ____________ en el parque hasta las 6:30 p.m. Yo 18(regresar) ____________ al hotel a las 7:00 p.m y 19(acostarse) ____________ porque 20(estar) ____________ muy cansada. Select all the correct answers.Alfred has a golden retriever named Max. Max can recognize people from their smell. Max starts to bark and wag his tail when Alfred reaches the gate of his house, even though Max is 50 yards away in his kennel. What are the reasons for Maxs ability to smell so well?Dogs have more olfactory receptors in their noses, allowing them to identify people by their smell.Dogs have highly sensitive olfactory receptors, allowing them to distinguish a persons unique odor.Dogs have better eyesight than humans, allowing them to see faraway objects.Dogs have an extended nervous system, allowing them to detect even the slightest movement in humans.Dogs have connected optic and olfactory systems, allowing them such precision in smell. QUESTION 23How much electric energy will be used by a 115 V, 60 W Eghtbulb in one minute69.221558006900)*Xpwe- Water is a valuable resource because it can be used for both human consumption and electricity generation. Which of the following choices is a poor way to conserve water?A) Doing a full load of laundry in the morninB)Using the dishwasher only when its full.C) Turning off the lights when you are not homeD) Taking a long shower to keep your brother from having any hot water. What determines when a cell divides?Please help i need a answer that is not off the internet it needs to be in own words.I will mark brainly please please help me URGENTThe Utica Boilermaker is a 15-kilometer road race. Sara is signed up to run this race and has done the following training runs:I. 10 yardsII. 44,880 feetIII. 15,560 yardsWhich run(s) are at least 15 kilometers?Option A: I, onlyOption B: II, onlyOption C: I and IIIOption D: II and III Science !!Where was the most recent earthquake closest to Plainfield, IL? Give some details. ps . Please make the details a short answer If you get it right you get 16 points PLZZ HELPP IM FAILLING What number could be a common denominator for these three fractions?1/2 and 1/3 and 1/4 A kangaroo hops 2 kilometers in 3 minutes. At this rate, how far does the kangaroo travel in 2 minutes? Round to the nearest tenth.