Answer:
t = [0:0.01:4];
x = 5*t - 10;
y = 25442 - 120*t + 144;
d = x.^2 + y.^2;
min = 1e+14;
for k = 1:length(t)
if d(k) < min
min = da(k);
tmin = t(k);
end
end
disp('The minimum distance is: ')
disp(sqrt(min))
disp('and it occurs at t = ')
disp(tmin)Output:
>> withLoop
The minimum distance is:
2.5106e+04
and it occurs at t =
4
Explanation:
Planning involves encouraging employees to engage in behaviors directly related to a goal accomplishment. It is the best way to have excellent performance because it motivates the employees to work harder. Planning involves goal setting, objectives, and determining the course of action to achieve the goal.
Answer:
The following fix were made to the program
- Change void main() to int main(), then set a return value at the end of the main function; e.g. return 0
- Remove system("pause"); It's not needed
- For each of the array, change their lengths to 5 i.e. int votes[5]; string name[5]; and float percent[5];
- Lastly, calculate the percentage using: percent[i]=((votes[i]*100.0/total))
Explanation:
(1) void main implies that the main function will not return any value. So, you change it to int main() and then set the return value
(2) There is no need to pause the program, so system.("pause") is not necessary.
(3) The question says there are 5 candidates. So, we set the arrays to accommodate inputs for 5 values
(4) percent array is declared as float; 100.0 will ensure that it calculates the percentage as a float value.
<em>See attachment for updated code</em>
Answer:
Following are the code in the C++ Programming Language.
cin.get(dummy);
cin.get(dummy);
cin >> inputInt;
Explanation:
In the above code that is written in the C++ Programming Language, the first two code is written for the string character input from the user and it input or not input the whitespace characters and the last one is used for the input of the integer character from the user. The character variable they used that is 'dummy' and the integer variable they used is 'inputInt'.