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
GrogVix [38]
3 years ago
6

What to do: please remember to comment each line.

Computers and Technology
1 answer:
Anni [7]3 years ago
3 0

Answer:

#include <iostream>

using namespace std;

int main()

{

   //initialization

  float x=0.0;

  float y;

  char operation;

  //print the message

   cout<<"Please enter the operation (Addition or Subtraction): ";

   cin>>operation;

   //loop for enter th operand again until enter 'q'

  while(operation != 'q'){

       //print the message for operand x

      cout<<"\nPlease enter the operand x: ";

      cin>>x;

       //print the message for operand y

      cout<<"\nPlease enter the operand y: ";

      cin>>y;

   //check for condition for '+' and if true then add the operands

      if(operation == '+'){

          x=x+y;

      }else if(operation == '-'){  //if user enter '-' then subtract the operands

          x=x-y;

      }

      //print the output

      cout<<"\nThe output is: "<<x<<endl;

      cout<<"\nPlease enter the operation (Addition or Subtraction): ";

      cin>>operation;

  }

  return 0;

}

Explanation:

Create the main function and define the variable x equals zero and declare the variables y and operation.

print the message for the user to enter the operation ('+' or '-') by using the instruction cout.

Store the value in the variable by using the instruction cin.

Then, take the loop to repeat the statement again and again until the condition is true.

print the message inside the loop for asking about the operands from the user.

then, use condition statement for checking the operation and if condition match, then execute the particular operation.

The above operation executes until the user enters not enter the character 'q'.

when the user enters the 'q', the loop terminates and print the output.

You might be interested in
I'm getting pretty desperate plz help me, I'll give brainiest, and ill make a free question worth 100 points this is for coding
Oksana_A [137]

Answer:

Pseudocode:

import random

fetch user input on a lucky number

insert input into variable - "response"

new variable, random = randint

condition to check wheather random is our response

display results

Python Code:

import random

def main():

response = int(input("Guess my lucky number, its between 1 and 100: "))

lucky_number = random.randint(1,100)

if response == lucky_number:

print(f"Wow you're right, it is {lucky_number}")

else:

print("Sorry, Try Again")

main()

Reminder:

intended for python3 as i included the format f

also it could be done without the import, just manually insert a number

i'll leave the post mortum to you

Explanation:

3 0
3 years ago
One main advantage of CD-ROMs is that
Mumz [18]
I believe the answer is a. CDMA rooms can store much more information than DVDS. good luck
7 0
3 years ago
When a cryptogrpahic system is used to protect data confientiality what takes place?
Alex73 [517]

Answer:

Unauthorized users are prevented from viewing or accessing the resource

5 0
2 years ago
A host wants to send a message to another host with the IP address 115.99.80.157. IP does not know the hardware address of the d
Darya [45]

Answer: ARP ( Address Resolution Protocol)

Explanation:

 The address resolution protocol is is one of the type transmission protocol that helps in determining the address of the MAC (Media access control) layer and the IPV4 address.

  • It is basically use for resolving the given IP address by using the hardware and the media access control in the network interface.
  • The main function of the ARP is that it typically used the MAC address for identifying the various types of mode in the network.
  • It is used the ARP format in the form of packet structure for transmitting the message from one place to another in the local network.    

  Therefore, the host is using the address resolution protocol for discovering the MAC address.  

3 0
3 years ago
Read 2 more answers
A computer’s BIOS is defined as the
Roman55 [17]

Answer:

c. software within hardware

Explanation:

The BIOS stands for a basic input/output system and is special system software that interfaces with all the main hardware of the PC with the OS. And it is generally stored in the flash memory chip which can be found on the motherboard, though sometimes the chip can be a kind of ROM. And when we turn on the computer, the BIOS does various important things. And it is not an application software for hardware. It is a system software.

8 0
3 years ago
Read 2 more answers
Other questions:
  • Select the correct answer.
    7·1 answer
  • How should you decide what to wear to an interview? What kind of things should be considered?
    5·1 answer
  • Which type of input peripheral is most prevalent in a Point of Sale system?A. External USB storage.
    8·2 answers
  • What is an example of a functional organizational structure?
    10·2 answers
  • Which item converts a high level language program to low level machine instruction?
    5·1 answer
  • What is thhe name of service included with windows server operating systemthat manages a centralized database containing user ac
    5·1 answer
  • Google Docs, MS Word, Google Slides, MS PowerPoint, Google Sheets, MS Excel In your opinion which software in each category is e
    7·2 answers
  • Is phone data used when connected to wifi
    12·1 answer
  • $
    15·2 answers
  • Select the three subjects studied in sports biomechanics.
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!