Below is 5 little problems that I am trying to do: 1. Write an if-statement that
ID: 3555954 • Letter: B
Question
Below is 5 little problems that I am trying to do:
1. Write an if-statement that does the following: if Age is 20 or above, Pass is 20; otherwise, Pass is 10. Both Age and Pass are already declared as integer variables.
Here is what I have:
if (Age >= 20)
cout << "Pass";
if (Age == 10)
cout << "Pass";
2. Complete the parameter of the following function, by adding a double variable b with the default value of 3.0.
double multiplyNumbers (int a, )
3. Write a for-loop statement that displays numbers from 1 to 10 in each line. Use Counter as a counter variable.
4. Write a single-line C++ statement to declare an integer array arrName with size of 20 elements. 4.
5. Write a switch statement, if a char variable Age is
Explanation / Answer
1. Write an if-statement that does the following: if Age is 20 or above, Pass is 20; otherwise, Pass is 10.
Both Age and Pass are already declared as integer variables.
Here is what I have:
if (Age >= 20)
Pass = 20;
else
Pass = 10;
2. Complete the parameter of the following function, by adding a double variable b with the default value of 3.0.
double multiplyNumbers (int a,double b=3.0)
3. Write a for-loop statement that displays numbers from 1 to 10 in each line. Use Counter as a counter variable.
for(Counter = 1; Counter <= 10; Counter++)
cout << Counter << endl;
4. Write a single-line C++ statement to declare an integer array arrName with size of 20 elements. 4.
int arrName[20];
5. Write a switch statement, if a char variable Age is
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.