Write a compare function that returns 1

Assignment Help Computer Engineering
Reference no: EM132101976

Write a compare function that returns 1 if a > b , 0 if a == b , and -1 if a < b.

The user must be prompted for the values of a and b. The compare function must have arguments for a and b.

To demonstrate your compare function, you must call the compare function three times, once for each condition, from within your program and display (using print statement) the return code of the function.

Of course you will make static calls to your function to meet the test requirements. Something like:

print compare(5,2)

print compare(2,5)

print compare(3,3)

Then your program will switch to user input. Something like:

print compare(user_input_A, user_input_B)

Use the following table of values for a and b can be used when calling to test your compare function from within your program:

Test values

a b

5 2

2 5

3 3

Reference no: EM132101976

Questions Cloud

Write a c program that will check the current setting : Write a C program that will check the current setting of "echo". It it is on, display the message and turn it off.
Public argument and civil society : In his article, "Public Argument and Civil Society," Thomas Kane argues that the Cold War had a "debilitating impact on American civil society
What are the security goals : What are the security goals and what are the possible security solutions to and countermeasures against threats?
Kant problem with predication : In Kant's problem with predication...I'm not sure which statement best describes it. I know it has to do with the fact that "exist
Write a compare function that returns 1 : The user must be prompted for the values of a and b. The compare function must have arguments for a and b.
Comparative analogical reasoning : Whats the correlation of the four tests of acceptability and how they relate to Comparative Analogical Reasoning.
What is the time for one double-and-add operation : Illustrate how the algorithm works for a = 19 and for a = 160. Do not perform elliptic curve operations, but keep P a variable.
Define a list comprehension to generate are infinite list : A positive integer is perfect if it equals the sum of all of its factors, excluding the number itself. For example, 6, 28, 496, and so on.
What are the ethical concerns of a parent : What are the ethical concerns of a parent helping with a student's schoolwork?

Reviews

Write a Review

Computer Engineering Questions & Answers

  How many gas stations are there in the united states

How many gas stations are there in the United States? How many people fly in and out of LaGuardia Airport every day?

  Summarize in your own words about nist

Student written reports are in Microsoft Word (.doc, .docx) format only 12 Arial font sizes; single space between lines; 1-inch borders.

  Explain what types of companies use which technology

The future of software development is now expected to be a near 50-50 split between Java and .Net. When making a decision on that technology to bank on, you should really research what types of companies use which technology.

  Program that counts the number of occurrences of lowercase

Write a program that counts the number of occurrences of lowercase and uppercase vowels in entered lines of text. Use a two-dimensional array to store the vowel counts.

  Create metadata entries for the data model components

Create metadata entries for the following data model components and, if possible, input the entries into a computer-aided software engineering (CASE) tool of your choosing:

  Write a program to determine the number of edges

Write a program to determine the number of edges in the transitive closure of a given directed graph, using the adjacency list representation.

  Write a java application that prompts the user for pairs

Write a Java application that prompts the user for pairs of inputs of a product number (1-5), and then an integer quantity of units sold (these are two separate prompts for input values).

  List the part entities that you can use for mating

What does an assembly mate do? List the part entities that you can use for mating. What are the differences between bottom-up and top-down assembly modeling?

  Difference between the extended and expanded memory

How many memory types are recognized by this tester tool? What is the difference between the extended and expanded memory

  List the hexadecimal code for each instruction

Consider the MARIE program below. a) List the hexadecimal code for each instruction. b) Draw the symbol table. c) What is the value stored in the AC when the program terminates?

  What is the impact of security breaches on society

List and define 4 specific computer attacks AND steps you can take to protect yourself. What is the impact of security breaches on society?

  Show that one-short is in np by sketching a polynomial time

Show that ONE-SHORT is in NP by sketching a polynomial time verifier for it.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd