How to execute this using vector
#include <iostream>
int main() {
int size, index, largest, smallest;
std::cout << "How many intergers you want to input? ";
std::cin >> size;
int myarray[size];
std::cout << "Input the elements of the array: ";
for (index = 0; index < size; index++)
std::cin >> myarray[index];
largest = myarray[0];
smallest = myarray[0];
for (index = 0; index < size; index++) {
// largest
if (myarray[index] > largest)
largest = myarray[index];
// smallest
if (myarray[index] < smallest)
smallest = myarray[index];
}
std::cout << "The largest element in the array is: " << largest << ".\n";
std::cout << "The smallest element in the array is: " << smallest << ".\n";
return 0;
}
Section 6.9 of your textbook ("Debugging") lists three possibilities to consider if a function is not working.
Write a program that will get the average of all integers from 1 to 20 using do while loop.
4. An automobile tire initially contains 0.25 lbm of air at 30 psig, 70 OF and have an automatic valve
that releases air whenever the pressure exceeds 32 psig. After driving, the temperature of air inside
rises to 120 OF, (a) what mass of air escapes to the atmosphere? lbm, (b) What is the tire gage
pressure when the remaining air inside has returned to 70 OF? psig
3. A steady state, steady flow compressor draws in 236 liters per second of air whose density is
1.268 kgm/m3 and discharges it with a density of 4.88 kgm/m3. At suction P1= 103.39 kPaa; at
discharge, P2 = 551.428 kPaa. The increase of specific internal energy is 78.45 kJ/kgm and the heat
from the air by cooling is 30.17 kJ/kgm. Neglecting the change in potential and kinetic energies,
determine the work in kJ/min.
2. A tank, initially empty, is in the form of a right circular cylinder with hemispherical ends. The overall
length of the cylinder tank is 3 meters and the diameter of the hemisphere is 1 meter. If a pump
discharges a fluid, whose density is 1.2 kgm/Liter, in this tank at a rate of 300 liters per minute
determine a.) Weight of liquid inside the tank after 5 minutes, KN, and b) total time to fill the tank,
min.
1. Saponification is a process wherein soap is added to a certain type of oil to produce grease. One
such grease is said to have 75.7 % by volume oil and 24.3% by volume soap, wherein the oil and
soap have densities 760 kgm/m3 and 6,250 kgm/m3, respectively. This kind of grease is sold by
packs shaped like a sphere with a diameter of 20 cm for convenience. Calculate: a) the mass of
oil per pack (kgm), b) the mass of soap per pack (kgm),c) the weight of each pack (kgf), d) the
specific weight of grease (N/m3), e) will the grease float if it is placed in water whose density is 1000 kgm/m3? Explain
Write a circle class with a private data member that is the radius (r) of the circle, and a parameterized
constructor that sets the value of the radius (r). In addition, the class includes common methods, such as
calculating the circumference of a circle, calculating the area of a circle, and getting the radius of a circle.
Enter the radius of the circle in the console to calculate and show the circumference and area of the circle.
A continuous cable (diameter 6 mm) with tension force T is attached to a horizontal frame member at B and C to support a sign structure, Fig. 1. The cable passes over a small pulley at D. The wire is made of a copper alloy, and the stress-strain relationship for the wire is (a) Find the axial normal strain in the cable and its elongation due to the load W = 6.8 kN (b) If the forces are removed, what is the permanent set of the cable. Hint: Start with constructing the stress-strain diagram and determine the modulus of elasticity, E and the 0.2% offset yield stress.
Vinegar and water are placed in a 1000ml bottle. Determine the mass of each of the substances placed inside the bottle if the product is a 75% water solution.( density of vinegar= 960 kg/cu m, density of water=1000 kg/cu m.