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
Anni [7]
3 years ago
9

In this lab, you complete a prewritten C++ program that computes the largest and smallest of three integer values. Instructions

Two variables named largest and smallest are declared for you. Use these variables to store the largest and smallest of the three integer values. You must decide what other variables you will need and initialize them if appropriate. Your program should prompt the user to enter 3 integers. Write the rest of the program using assignment statements, if statements, or if else statements as appropriate. There are comments in the code that tell you where you should write your statements. The output statements are written for you. Execute the program by clicking the Run button at the bottom of the screen. Using the input of -50, 53, 78, your output should be: The largest value is 78 The smallest value is -50
Computers and Technology
1 answer:
irakobra [83]3 years ago
7 0

Answer:

The program in C++ is as follows

#include <iostream>

using namespace std;

int main(){

   int n1, n2, n3, largest, smallest;

   cin>>n1>>n2>>n3;

   if(n1 >= n2 && n1>=n3){        largest = n1;    }

   else if(n2 >= n1 && n2>=n3){        largest = n2;    }

   else{        largest = n3;    }

   if(n1 <= n2 && n1<=n3){        smallest = n1;    }

   else if(n2 <= n1 && n2<=n3){        smallest = n2;    }

   else{        largest = n3;    }

   cout<<"Smallest: "<<smallest<<endl;

   cout<<"Largest: "<<largest<<endl;

   return 0;

}

Explanation:

Declare all variables

   int n1, n2, n3, largest, smallest;

Get input for the three numbers

   cin>>n1>>n2>>n3;

Check if n1 is the largest

   if(n1 >= n2 && n1>=n3){        largest = n1;    }

Check if n2 is the largest

   else if(n2 >= n1 && n2>=n3){        largest = n2;    }

Otherwise, n3 is the largest

   else{        largest = n3;    }

Check if n1 is the smallest

   if(n1 <= n2 && n1<=n3){        smallest = n1;    }

Check if n2 is the smallest

   else if(n2 <= n1 && n2<=n3){        smallest = n2;    }

Otherwise, n3 is the smallest

  else{        largest = n3;    }

Print the smallest

   cout<<"Smallest: "<<smallest<<endl;

Print the largest

   cout<<"Largest: "<<largest<<endl;

You might be interested in
Human-centered technology often recommends _______ao
lidiya [134]

Answer:

Creating objects which people are going to interact with, designers have to be aware of those traits and take them into account in the process. ... Continuing the theme, user-centered design is more focused and concise version of human-centered design with deeper analysis of target audience.The user interacts directly with hardware for the human input and output such as displays, e.g. through a graphical user interface. The user interacts with the computer over this software interface using the given input and output (I/O) hardware.Human-centered design is a creative approach to problem solving and the backbone of our work at IDEO.org. It's a process that starts with the people you're designing for and ends with new solutions that are tailor made to suit their needs. ... Human-centered design consists of three phases.

Explanation:

3 0
3 years ago
Read 2 more answers
2. It is the art of creating computer graphics or images in art, print media, video games.
vfiekz [6]
The answer is CGI :)
4 0
3 years ago
He ____ content of a web page contains information used by search engines to help users find your website.
luda_lava [24]
The header content of a web-page can contain meta tags that classify the page. Search engines use this information.
6 0
4 years ago
HELP WITH COMPURER SCIENCE 50!!!!!!!!!!!!!!!!!!!!!!!!!!!! POINTS PLEASE I HAVE A TEST RIGHT NOW
storchak [24]

Answer:

what is learning about

Explanation:

6 0
3 years ago
Microsoft word's spell checker?
vekshin1
The answer to the given picture is - Microsoft word's spell checker only recognizes very common words. Microsoft word has it's own dictionary which will be compared to the texts on your document. If they see an unfamiliar word they will underline it with red. Anyways you can add your own words and names to the custom dictionary.
8 0
3 years ago
Other questions:
  • Create a cell reference in a formula by typing in the cell name or
    7·2 answers
  • Is a set of standards that define how email is to be processed between mail servers is exactly the same as smtp copies an e-mail
    10·1 answer
  • PLEASE HELP!!!! I'll mark Brainliest for whoever is first!!!!
    13·2 answers
  • Which system is a type of artificial intelligence that uses a database, containing facts and rules, to provide assistance to use
    9·1 answer
  • has anyone noticed to get credit for answering a question you don't even need to answer it correctly?
    11·2 answers
  • Ancler Corporation wants to calculate how much their profits were in the first quarter of the year. They should use a
    6·2 answers
  • [BRAINLIEST!!!! Which concept in OOP explains the relationship between the classes Nation and President, where the class Nation
    6·2 answers
  • The given SQL creates a Movie table with an auto-incrementing ID column. Write a single INSERT statement immediately after the C
    12·1 answer
  • Name the character encoding standard that enables up to 128 different commonly used characters,
    8·1 answer
  • Qué es que puede pasar lo mismo con la galaxia<br>​
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!