CAUsersMAC-PRONDecumentslmeyerigestThre.cpp - Dev-C- SA0 Ale Ede Search View Praject ecute Debug Teels CVS window Help (glebala) Project cOD (1lgesthree.cpp 7e int main () { /* read in three integers a, b, and c * output the three numbers in ascending order * without changing the content of a, b or c */ 8. 9. 10 11 13 int a, b, c, х, у, 2; 14 15 cout<<"please enter three integers to be sorted"<>a>>b>>c; 19 cout<<"the original numbers are "<=x) y=b; 23 24 25 else {y=x; // move x to y x=b; 26e 28 29 30 if (c>=y) 31 z=c; 32 else if (c>=x) {z=y; y=c;} 33 34e 35 36 else 37 OH2 34 222 233 333 333m else if (c>=x) {z=y; y=c;} else z=y; y=x; x=c; cout<<"the numbers in ascending sequence are "<

Question

write a code using different algorithm

CAUsersMAC-PRONDecumentslmeyerigestThre.cpp - Dev-C- SA0
Ale Ede Search View Praject ecute Debug Teels CVS window Help
(glebala)
Project cOD (1lgesthree.cpp
7e int main () {
/* read in three integers a, b, and c
* output the three numbers in ascending order
* without changing the content of a, b or c
*/
8.
9.
10
11
13
int a, b, c, х, у, 2;
14
15
cout<<"please enter three integers to be sorted"<<endl;
16
17
18
cin>>a>>b>>c;
19
cout<<"the original numbers are "<<a<<", "<<b<<", "<<c<<endl;
20
21
x=a; // assume a is the smallest
if (b>=x)
y=b;
23
24
25
else
{y=x; // move x to y
x=b;
26e
28
29
30
if (c>=y)
31
z=c;
32
else
if (c>=x)
{z=y;
y=c;}
33
34e
35
36
else
37
OH2 34
222 233 333 333m
View transcribed image text
Expand
else
if (c>=x)
{z=y;
y=c;}
else
z=y;
y=x;
x=c;
cout<<"the numbers in ascending sequence are "<<x<<'", "<<y<<", "<z<<end1;
Capture Effects Tools Help
View transcribed image text
Expand

Expert Answer

Want to see the step-by-step answer?

Check out a sample Q&A here.

Want to see this answer and more?

Experts are waiting 24/7 to provide step-by-step solutions in as fast as 30 minutes!*

*Response times may vary by subject and question complexity. Median response time is 34 minutes for paid subscribers and may be longer for promotional offers.
Tagged in
Engineering
Computer Science

Object Oriented Programming

Related Computer Science Q&A

Find answers to questions asked by students like you.

Q: How to create a class named vehicle in java that contains the variables String manufacturer and Stri...

A: Creating class Vehicle: The class Vehicle has two String objects- manufacturer and owner. There are ...

Q: Please help    1  Problem Statement: You are the CTO of a startup based out of Arlington, VA that ne...

A: Create an ERD for the database that contains the details of the customers who purchased one or more ...

Q: 3 (a and b), 6 (a and b), 8 (a, b and c)

A: To Prove  using Boolean algebra consensus theorem

Q: Given the following, what is assigned to the lvalue? integer = int('9.9') A. 9 B. 9.9 C. 10 D. None ...

A: ANSWER: Based on two statements, one can predict the answer for the given question. “int ('9.9')”- ...

Q: Summarize the differences among 1G, 2G, 3G and 4G wireless communications systems.

A: Click to see the answer

Q: using namespace std;

A: First of all you need to know namespace is a feature which is added in c++ like as: #include &lt;ios...

Q: ) Is the following a valid. duction Rule? Explain in detail why or why not? P -Q .P + (Q ^ R)

A: Check the validity of the argument. 

Q: Specify any four difference between Client/Server computing and Peer-to-Peer computing. Which archit...

A: Difference between client/server computing and peer to peer computing:

Q: Devise a greedy algorithm that uses the minimum number of towers possible to provide cell service to...

A: Procedure: Firstly, sort the list from the smallest to largest. Declare variable S that contains to ...

Q: JAVA Using the code provided below called intSet create an iterator called sortedElements and the in...

A: An EmptyException class is created which will throw an exception when size is empty. An inner static...

Q: Imagine we are using a two-dimensional array as the basis for creating the game battle- ship. In the...

A: The system shows "Can not open file" for the following reasons: It cannot find the mentioned file b...

Q: 4

A: Let ‘s discuss the Boolean equation which is represented by the following k-map: This is a three va...

Q: How could I change the attached Python program, so that I can: 1.  input my beginning fuel (in gallo...

A: Variables like input_fuel, available_fuel and destinations are declared. Variable destinations is a ...

Q: PART C: COMBO STRINGGiven 2 strings, str1 and str2, print out a string of the form short+long+short,...

A: Program: //include the header file import java.util.Scanner;   //definition of "Main" class public c...

Q: In PYTHON, when copying "LISTS", what is the difference between the following:                first_...

A: When the list is copied using first_list =new_list[:] following things happen: All elements of the ...

Q: How exactly does SETI work with respect to cloud computing?

A: Cloud SETI turns the system into an alien finding satellite. SETI stands for Search for Extraterrest...

Q: What is the value of the variable count after the function has been called 2 times? void myPrint( in...

A: To solve this problem, first of all you need to know what is static variable. Let’s start the discus...

Q: Given the declarations charWord2[25]; and char Word3[25]; write the C statement that replaces the co...

A: Two string type variables char Word2[25]; and char Word3[25]; are given. Replace the contents of the...

Q: what is the equivalent 2's complement representation for - 15 in 16-bit hexadecimal representation?

A: Explanation:   To find the 16-bit hexadecimal number of -15, one can use the following steps demons...

Q: Describe the individual functions and flow described in the flow chart.(Restrict your documentation ...

A: As you know, the Rectangle is used to capture the functions and arrow keys indicate the directional ...

Q: PART D: OMIT INITIALGiven 2 strings, str1 and str2, print out their concatenation, except omit the f...

A: PROGRAM: //Defining the class Stringconcat class Stringconcat {    //Defining the function concatstr...

Q: Describe the phenomenon of cascading rollback. How can cascading rollback be avoid in a cascadeless ...

A: The phenomenon of cascading rollback and how it can be avoided in a cascadeless schedule.

Q: 1 question on each picture

A: We are authorized to answer one question at a time since you have not mentioned which question you a...

Q: JAVA Using the code provided below called intSet create an iterator called sortedElements and the in...

A: PROGRAM INTRO:   An EmptyException class is created which will throw an exception when size is empt...

Q: I'm trying to create classes in C#... here is the question: Create an Employee class. Items to inclu...

A: The name of the class is the Employee. The data members of the Employee class are employee number, f...

Q: 7. The two problems below can be solved using graph coloring. For each problem, represent the situat...

A: a. Let the vertices denote the teams and the edges as the game played between them. This problem can...

Q: 1 Problem Statement: You are the CTO of a startup based out of Arlington, VA that needs to setup a d...

A: We are authorized to answer one question at a time since you have not mentioned which question you a...

Q: 1) Add a slider whose value represents the length of the password 2) Add generate button that genera...

A: &lt;!DOCTYPE HTML&gt; &lt;html&gt;   &lt;head&gt;             &lt;style&gt;                         ...

Q: Imagine we are using a two-dimensional array as the basis for creating the game battle- ship. In the...

A: An example file is missing the question. The below answer is provided with the following example, Sc...

Q: Talk about Big data and how the organizations use it these days and why?

A: Big data is a technology for database management systems that is used to handle large amount of data...

Q: Write a program that allows the user to enter the last names of five candidates in a local election ...

A: You need to input the last names of five candidates in a local election and the number of votes rece...

Q: Given the complement of a graph G is a graph G' which contains all the vertices of G, but for each u...

A: The logical operations that can be applied to adjacency matrix of G to produce G' are: XOR G's adja...

Q: in phython language Write the following program without using the break statement. You may use conju...

A: Instead of using break to exit the loop, exit() can be used to exit the loop once the condition matc...

Q: 4.9 In this exercise, we examine how data dependences affect execution in the basic 5-stage pipeline...

A: Given instruction: Let assume the following instruction sequences: or r1, r2, r3            - Instru...

Q: Write a recursive function rec_string that produces the output shown below for the corresponding fun...

A: PROGRAM: #Defining the function rec_string with parameter def rec_string(st):   #if condition   if l...

Q: How do you will design an algorithm (or program logic) declares two integers and initializes them to...

A: The algorithm to solve the problem is given below,

Q: 3. Show that the premises "It is not Sunny this afternoon and it is colder than yesterday." "We will...

A: Construct a valid argument using the inference rule for the conclusion.

Q: The population of town A is less than population of town B. However, the population of town A is gro...

A: To solve the given Query, first of all you need to prompts the user to enter the population and grow...

Q: Develop a pseudo-code algorithm for a level-order traversal of a binary tree. Create an array-based ...

A: As per the Honor Code, we are allowed to solve one question at a time. Kindly post other questions s...

Q: Algorithm We already have an algorithm for Patient Temperature. It will not change. The Algorithm fo...

A: Instead of using false we user the following conditions in if...else statements: if ( (userResponse...

Q: Consider the following class code segment: class aNewClass {   public:   …….   private:     string ...

A: class aNewClass {     public:   …….     private:     string name;     int *q;     int length; }; // ...

Q: Programing C

A: To solve this problem, First of all you need to create a structure customer with three members, one ...

Q: in java At KU college, the tuition for a full-time student is $8,500.00 PER It has been announced th...

A: A Java program for the given criteria is as follows, File name: “Sample.java” import java.util.Scann...

Q: Convert binary fraction 0.10012 to Decimal fraction.

A: Procedure to convert binary fraction(0.1001) to decimal number: Starting with rightmost number digi...

Q: explain the business-IT maturity model

A: Business IT-Maturity-model: The word maturity means measuring the capability of an organization for...

Q: BELOW IS THE NETBEAN SOURCE CODE OF A SINGLETON PROJECT. Run the code in Netbeans and provide screen...

A: Given program: /* * To change this license header, choose License Headers in Project Properties. * T...

Q: Q1. Assume X is an array of char such that cahr X[] = “welcome C++II students to pointer camp, come ...

A: Create a function of char type to get the words from the string. Inside the function – Take a point...

Q: List the eight main guidelines for user interface design. How would you rank them in order of import...

A: Eight main guidelines for user interface design and ranking them based on their importance: Create ...

Q: For the list below, what runs would be created if M=3 using replacement selection? 10, 1, 5, 2, 6, 8...

A: To identify the number of runs in the replacement selection sort.

Q: 1. Write a program that reads a file consisting of students' test scores in the range 0-200. It shou...

A: Save the text file with the name of “score” and make sure that its extension should be “.txt”. Save ...

Transcribed Image Text

CAUsersMAC-PRONDecumentslmeyerigestThre.cpp - Dev-C- SA0 Ale Ede Search View Praject ecute Debug Teels CVS window Help (glebala) Project cOD (1lgesthree.cpp 7e int main () { /* read in three integers a, b, and c * output the three numbers in ascending order * without changing the content of a, b or c */ 8. 9. 10 11 13 int a, b, c, х, у, 2; 14 15 cout<<"please enter three integers to be sorted"<<endl; 16 17 18 cin>>a>>b>>c; 19 cout<<"the original numbers are "<<a<<", "<<b<<", "<<c<<endl; 20 21 x=a; // assume a is the smallest if (b>=x) y=b; 23 24 25 else {y=x; // move x to y x=b; 26e 28 29 30 if (c>=y) 31 z=c; 32 else if (c>=x) {z=y; y=c;} 33 34e 35 36 else 37 OH2 34 222 233 333 333m

else if (c>=x) {z=y; y=c;} else z=y; y=x; x=c; cout<<"the numbers in ascending sequence are "<<x<<'", "<<y<<", "<z<<end1; Capture Effects Tools Help