Largest and smallest element in an array

Assignment Help Software Engineering
Reference no: EM13667227

1. Write a simple program to determine the difference between the largest and smallest element in an array of size 10. Your program should ask the user to fill in the elements of the array. Your program should use only pointer variables and dynamic memory except for the array. For example, even an index variable in a loop must be a pointer variable. Note that your array should be able to accommodate real numbers as well as negative numbers. A sample run of the program is given below.

Please input the array values
5 -1 3.4 5 -6.7 9 10 100 4 -9.1
Largest value: 100
Smallest value: -9.1
Difference: 109.1

2. Write a C++ program called hw2_2_yourlastname.cpp that draw a diamond as the sample execution below. In the program, you can assume that the number given by a user is always valid (= positive number). In the program, you must use only pointer variables and dynamic memory. [For instance, even an index variable in a loop must be a pointer variable]. A sample run of your program should be like below:

Enter a number: 5
*
***
*****
*******
*********
*******
*****
***
*

This is another sample run of your program:
Enter a number: 3
*
***
*****
***
*

Reference no: EM13667227

Questions Cloud

What is the amplitude of the magnetic field : An electromagnetic wave is traveling in +X direction. The amplitude of the electric field is 6.0 V/m. What is the amplitude of the magnetic field?
Determine the period of the motion : An electron with kinetic energy 1.40 keV circles in a plane perpendicular to a uniform magnetic field. Determine the period of the motion
What is the intensity of the transmitted light : When a beam of unpolarized light of intensity 2.4 X 10-4W/m  2 passes during a thin polarizing filter the transmitted light is linearly polarized in the direction 30 degrees from the x-axis. What is the intensity of the transmitted light?
What will be the length of the wire : Assume that you wish to fabricate a uniform wire out of0.950 g of copper. If the wire is to have a resistance R = 0.500, and if all of the copper is to be used. What will be the length of the wire?
Largest and smallest element in an array : Write a simple program to determine the difference between the largest and smallest element in an array.
Determine the young modulus for the relaxed muscle : A relaxed biceps muscle requires a force of 25.0 Newton for an elongation of 3.0 centimeter; the same muscle under maximum tension requires a force of 500 N for the same elongation. Determine the Young modulus for the relaxed muscle
Light string that passes over a pulley of moment of inertia : Two blocks of masses 2 kg and 3 kg, are linked by a light string that passes over a pulley of moment of inertia 0.004kg·m 2 and radius 5 cm. The coefficient of friction for the table top is 0.30. The blocks are released from rest. Using energy method..
Small planet has the similar density of the earth : Assume that a person can jump straight up a distance of 61 cm on the surface of the earth. How small would a planet have to be so that the person could jump totally off (i.e. jump up and not come down)? Suppose that Earth's radius is 6380 km and that..
What is the direction of the current in the wire : A 2.50 meter long copper wire has a mass of 0.25 kilograms. A magnetic field of 0.15 Teslas is oriented horizontally from south to north. What is the minimum current in the rod that would allow it to "float" in this magnetic field? What is the direct..

Reviews

Write a Review

Software Engineering Questions & Answers

  Explain teaching hypervisor design and implementation

Teaching Hypervisor Design, Implementation, and Control to Undergraduate Computer Science and Computer Engineering Students

  You have been recently employed as the director of

you have been recently employed as the director of operations of a hotel. the hotel is in a relatively large city with

  Explain the characteristics of visual studio 2005

Explain the characteristics of Visual Studio 2005.

  Explain the following command lines

For example, sed 's/fox/ox/g' file will replace all occurance of fox with ox and not the just the first one in file.

  Draw a context diagram for the order system

Kitchen Gadgets sells a line of high-quality kitchen utensils and gadgets. When customers place orders on the company's Web site or through electronic data interchange

  Web authoring application

Compare the drawbacks and benefits of using a Web authoring application, an HTML editor and a text editor for developing websites.

  Part 1a the report should include a paragraph or two

part 1a the report should include a paragraph or two discussing icann.bnbsp discuss registered domain names including i

  Research the method of system development life cycle

question 1 what is systems development? list the main activities in systems development.your response should be at

  Leadership challenge juggling culturesculture gender and

leadership challenge juggling culturesculture gender and leadership are closely related. in most cultures even western

  Suggestions for viable guidelines

Do you think that variations in company and societal culture could pose a significant problem when coordinating or scheduling large assignments,

  You have been hired as the cio of a large multinational

you have been hired as the cio of a large multinational internet advertising company. the president of the company is

  Create logic for program that will produce count of readers

Create the logic for a program that would produce a count of readers by income groups as follows: under $20,000, $20,000- $29,999, $30,000-$49,999, $50,000-$69,999, and $70,000 and up.

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