1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Elenna [48]
3 years ago
7

Create a script to input 2 numbers from the user. The script will then ask the user to perform a numerical calculation of additi

on, subtraction, multiplication, or division. Once the calculation is performed, the script will end.
Computers and Technology
1 answer:
ohaa [14]3 years ago
5 0

Answer:

The code given is written in C++

First we declare the variables to be used during the execution. The names given are self-explanatory.

Then the program outputs a request on the screen and waits for user input, for both numbers and one more time for the math operation wanted, selected with numbers 1 to 4.

Finally, the program executes the operation selected and outputs the result on screen.  

Code:

<em>#include <iostream> </em>

<em> int main() </em>

<em>{ </em>

<em> // variable declaration </em>

<em> float numberA; </em>

<em> float numberB; </em>

<em> int operation; </em>

<em> float result=0; </em>

<em> </em>

<em> //number request </em>

<em> std::cout<<"Type first number:\n"; std::cin>>numberA; </em>

<em> std::cout<<"Type second number:\n"; std::cin>>numberB; </em>

<em>  </em>

<em> //Operation selection </em>

<em> cout << "Select an operation\n"; </em>

<em> cout << "(1) Addition\n"; </em>

<em> cout << "(2) Subtraction\n"; </em>

<em> cout << "(3) Multiplication\n"; </em>

<em> cout << "(4) Division\n"; </em>

<em> std::cout<<"Operation:\n"; std::cin>>operation; </em>

<em> </em>

<em> switch(operation){ </em>

<em>  case 1: </em>

<em>   result = numberA+numberB; </em>

<em>   break; </em>

<em>  case 2: </em>

<em>   result = numberA-numberB; </em>

<em>   break; </em>

<em>  case 3: </em>

<em>   result = numberA*numberB; </em>

<em>   break; </em>

<em>  case 4: </em>

<em>   result = numberA/numberB; </em>

<em>   break;    </em>

<em>  default: </em>

<em>   std::cout<<"Incorrect option\n"; </em>

<em>  }</em>

<em> //Show result </em>

<em> std::cout<<"Result is:"<<result<<::std::endl; </em>

<em> return 0; </em>

<em>}</em>

You might be interested in
Handhed computer is otherwise called as<br> 1.laptop<br> 2.Notebook<br> 3.Palmtop
NikAS [45]

Answer:

personal digital assistants (PDAs)palmtop

3 0
3 years ago
Case 2-2 Jack has a computer at home that he uses to access the Internet, store and edit personal photos, and create and edit do
bekas [8.4K]

Answer:

Check button under error checking

Explanation:

Under the Tools tab there are two options:

Error checking and Optimize and defragment drive option.

clicking the check button with administrative permission under error checking option will examine the hard drive for errors.

3 0
3 years ago
Is it possible to build something that doesn't exist yet?
Anastasy [175]

Answer:

yes

Explanation:

how do u think other thing were built like when phones were first made

5 0
3 years ago
Select the correct answer.
dedylja [7]

Answer:

D. MAN

Explanation:

A local area network (LAN) refers to a group of personal computers (PCs) or terminals that are located within the same general area and connected by a common network cable (communication circuit), so that they can exchange information from one node of the network to another. A local area network (LAN) is typically used in small or limited areas such as a set of rooms, a single building, school, hospital, or a set of well-connected buildings. Some of the network devices or equipments used in a local area network (LAN) includes an access point, personal computers, a switch, a router, printer, etc.

On the other hand, a metropolitan area network (MAN) is formed by an aggregation of multiple local area network (LAN) that are interconnected using backbone provided by an internet service provider (ISP). A metropolitan area network (MAN) spans for about 5 kilometers to 50 kilometers in size.

Basically, a metropolitan area network (MAN) spans across a geographic area such as a city and it's larger than a local area network (LAN) but significantly smaller than a wide area network (WAN).

In conclusion, the network type that the patrol services of a city's police department would most likely use is a metropolitan area network (MAN).

6 0
3 years ago
You are implementing a new application control solution. Prior to enforcing your application whitelist, you want to monitor user
shepuryov [24]

Answer: Flag

Explanation:

When using an application control solution, it should be noted that the application whitelist is typically centrally defined which is applied to the network devices. In such case, the applications that are contained in the whitelist will be the only one that are allowed.

Therefore, the applications that are not contained in the whitelist should be flagged. This is necessary in order to effectively monitor the user traffic for a period of time in order to discover user behaviors.

5 0
3 years ago
Other questions:
  • Write a program that calls fork(). Before calling fork(), have the main process access a variable (e.g., x) and set its value to
    5·1 answer
  • Explain why computer users should use the cloud?
    14·1 answer
  • Although designed to support remote dial-in access to a corporate network, what service below is commonly used with 802.1x port
    12·1 answer
  • Match the categories in the first column with examples in the second column.
    14·1 answer
  • When you look directly at a camera lens, it may seen like there is only one lens, but entering light actually passes through a s
    12·1 answer
  • The US government appropriates less than one million dollars in funding each year to STEM education programs. True False
    7·2 answers
  • An electronic ____ is an application you use to perform numeric calculations and to analyze and present numeric data.
    9·1 answer
  • (Correct Answer Recieves Brainliest)
    8·2 answers
  • What is the purpose of a computer virus? O to spread a disease to humans O to substitute for a human disease a O to disrupt a co
    11·1 answer
  • User 2.0 is most likely to Multiple Choice passively read and search for content. depend on content creators and avoid expressin
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!