Reference no: EM13759257
I'm just beginning basic programming and need the most basic syntax possible. We've only gone as far as loops and here are two example questions I need you to code similarly to. BTW this is a loop lab, so there will be a for, while, etc. loop and maybe an if statement. Please use Visual Studio if possible because that is what we are required to use, but if you can code exactly the same in NetBeans go for it.
1.) Write a program to print the following numbers:
5 10 15 20 25 30 35
#include<iostream>
usingnamespace std;
int main()
{
for (int i = 5; i <= 35; i += 5) {
cout << i << endl;
}
system("pause");
}
2.) Write code that will ask the user to input a number between (50-100) and print how many odd & even numbers between that number and 200.
#include<iostream>
usingnamespace std;
int main()
{
int evens = 0;
int odds = 0;
int val = 0;
cout << "Enter a number between 50-100: " << endl;
cin >> val;
while (val < 200) {
if (val % 2 == 1) odds++;
else evens++;
val++;
}
cout << odds << endl;
cout << evens << endl;
system("pause");
}
THE REAL QUESTIONS
1.) Write code that will ask the user to input a 4 digit code say "3456" à Drive the user crazy by insisting they entered a wrong code even if they entered the correct code!! After 3 attempts, display a message telling the user you were messing with them! And they are now logged in.
2.) 1. Write code that will print the square roots of the first 25 odd positive integers.For each odd number print the following sentence: The square root of __ is __.
3.) Try to run the following program at https://cpp.sh/
#include <iostream>
using namespace std;
int main()
{
int hour;
int min;
for (hour = 1; hour <= 11; hour++)
{
for (min = 0; min <= 59; min++)
{
cout << hour << ":" << min << "AM" << endl;
}
}
system("pause");
return 0;
}
1. What is the bug or logic error in the above program?
2. Add the lines to fix it.
3. This is an example of __nested__________ loops.
4. How many times does the outer loop execute?
5. How many times does the inner loop execute?
6. Make the times more accurate by adding lines of code to print seconds.
Monetary base and the banks reserve ratio
: Calculate the monetary base and the banks reserve ratio. - Calculate the total money creation in the economy with the help of formula.
|
Compatibility of strategies at the corporate-unit
: The compatibility of strategies at the corporate, unit, and functional levels. Are Hiller’s general business strategy (buying distressed, undervalued properties and turning them around for eventual sale) and their human resource (HR) strategy compati..
|
Strategy for addressing the associated risk
: For each of the three (3) or more malicious attacks and / or threats that you identified in Assignment, choose a strategy for addressing the associated risk (i.e., risk mitigation, risk assignment, risk acceptance, or risk avoidance). Explain your..
|
Explain deduction-taxability of compensation
: Explain "Deduction- Taxability of Compensation" (It is related HR employee benefie, qualify plan question)
|
What is the bug or logic error in the above program
: What is the bug or logic error in the above program. Add the lines to fix it. This is an example of __nested__________ loops. How many times does the outer loop execute
|
Sustain the westwards competitive advantage
: Prepare a Five Forces Analysis and make a determination as to whether Hiller can sustain the Westward’s competitive advantage (should it choose to retain the property)
|
Designing a quality control-what will be the critical value
: You are designing a quality control system for the waiting time to see a doctor in the emergency room for the TMC. (Toledo Medical Center). You are taking samples of size n on the hour every hour, measure the average time for the “most” recent n pati..
|
Potential logical threats that require attention
: Information Systems Security, Suppose you are the IT professional in charge of security for a small pharmacy that has recently opened within a shopping mall. Determine the impact of at least five (5) potential logical threats that require attention
|
What will be the new confidence interval
: Suppose that the confidence interval for the population mean of summer income of undergraduate fulltime students using a sample size of 50, confidence level of 0.9 is [7000,10000]. If you increase the confidence level to 0.95, all other things remain..
|