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
Digiron [165]
4 years ago
12

Making Decisions Programming Challenges 1. Minimum/Maximum Write a program that asks the user to enter two numbers. The program

should use the conditional operator to determine which number is the smaller and which is the larger?
Computers and Technology
1 answer:
Bas_tet [7]4 years ago
3 0

Answer:

int main()

{

   int a,b,max,min;

   cout<<"Enter 2 numbers\n";

   cin>>a>>b;    //asking numbers from user

   max= a>b ? a : b;   //using conditional operator to find larger

   min= a>b ? b : a;    //using conditional operator to find smaller

   cout<<"\nLarger is "<<max;

   cout<<"\nSmaller is "<<min;

   return 0;

}

OUTPUT :

Enter 2 numbers

56

34

Larger is 56

Smaller is 34

Explanation:

  • In the above program, first user is asked to enter 2 numbers which needs to be compared.
  • Conditional operator - This operator contains syntax - (condition ? true : false) . This is a ternary operator in which first operand checks the condition and if its true second operand is returned otherwise third is returned.
  • Then conditional operator is used twice first to find larger number and then smaller.
  • At last both numbers are printed.
You might be interested in
Lynn has created a quarterly sales report using a word processor. The document is confidential, and Lynn wants to secure it with
sweet-ann [11.9K]
Stop cheating



It’s b
3 0
3 years ago
O How basic blocks are identified and how the blocks are used to construct control flow graphs
OLEGan [10]

Basic blocks are identified  because they are known to be a straight line that is known also as a code sequence that tends to have no branches in regards to its in and out branches and its exception is only to the entry and at the end.

Note that  Basic Block is said to be a composition  of statements that is known to be one that often always executes one after other, and this is often done in a sequence.

<h3>How do you create a flow graph from the basic blocks?</h3>

Flow graph  is gotten by:

  • Lets Block B1 be the initial node and also Block B2 will tend to follows B1, so from B2 to B1 there is seen a kind of an edge.

Note that the first task is for a person to partition a sequence of three-address code and this is done into basic blocks.

Hence, Basic blocks are identified  because they are known to be a straight line that is known also as a code sequence that tends to have no branches in regards to its in and out branches and its exception is only to the entry and at the end.

Learn more about basic blocks from

brainly.com/question/132319

#SPJ1

5 0
2 years ago
What is a bitmap ???
leva [86]
<span>a representation in which each item corresponds to one or more bits of information, especially the information used to control the display of a computer screen.
</span><span>represent (an item) as a bitmap.
</span>
4 0
4 years ago
Read 2 more answers
Positive thinkers tend to
andreev551 [17]

Answer:

I would say D hope this helps

3 0
4 years ago
Read 2 more answers
What is remote assistance?
Slav-nsk [51]

Answer:

Quick Assist, Windows 10 feature, allows a user to view or control a remote Windows computer over a network or the Internet to resolve issues without directly touching the unit. It is based on the Remote Desktop Protocol.

Explanation:

.....

3 0
3 years ago
Other questions:
  • URGENT!!!
    13·2 answers
  • A tornado may be approaching if you observe which of the following?
    15·1 answer
  • All of the following are recommended to secure a wireless network EXCEPT:
    5·2 answers
  • Which protocol do many browsers assume when you enter a URL in the address field?
    9·1 answer
  • Purpose: This application provides experience with user input and interaction in the Console, writing files to disk, working wit
    9·1 answer
  • How is kerning used in Word?
    7·2 answers
  • What does choosing Slide Sorter view do?
    8·1 answer
  • Compare the two items in a summary of qualifications taken from a resumé. Which is better?
    9·1 answer
  • What is the difference between RELIABLE and UNRELIABLE sources of<br> income?
    7·2 answers
  • In cells D6 through D8, enter formulas to calculate the values of the stocks. The formulas should multiply the number of shares
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!