#include <iostream>
using namespace std;
int main() {
char t = 'T';
char f = 'F';
cout << t << " is short for true. ";
cout << f << " is short for false." << endl; cout << f << " is short for false." << endl;
}
Finish the code below so that it prints βI drive a 2014 Buick Regalβ. Use the lines to construct the pseudocode, then go back to complete the exercise.
Finish the code below so that it prints βI drive a 2014 Buick Regalβ. Use the lines to construct the pseudocode, then go back to complete the exercise.
Open main()
---
Initialize variable make as string
---
Assign Buick to make;
---
Initialize year as int;
---
Initialize year as double; #paired
---
Assign a number to year;
---
Initialize model as string;
---
Initialize model as char; #paired
---
Assign model name to model;
---
Output year and make;
---
Output model name;
---
Close main()
Finish the code below so that it returns the correct volume of a sphere. Hint: think about what happens when you use integer division. The volume of a sphere is given by:
\begin{equation*}
V = \frac{4}{3} \pi r^3
\end{equation*}
Below is one way to complete the program. There are many creative ways that you could use the order of operations to come up with a complex expression that will bring you to βaβ, here is one way.
Write code that assigns βapplesβ to the variable oranges, and βorangesβ to the variable apples, then swaps their values. Be sure to include any necessary headers. YOU MAY NOT HARDCODE YOUR SOLUTION.
Open main()
---
Initialize oranges as string;
---
Assign "apples" to oranges;
---
Initialize apples as string;
---
Assign "oranges" to apples;
---
Assign apples to a temporary variable;
---
Assign oranges to apples;
---
Assign the temporary variable to oranges;
---
Output apples and oranges;
---
Close main()
Write code that calculates how much you you will spend after tipping 20% on your $36.25 dinner. Save the result of this calculation in plusTip. Be sure to include any necessary headers.
Open main()
---
Initialize and assign $36.25 to price;
---
Initialize and assign 1.20 to tip;
---
Initialize and assign .20 to tip; #paired
---
Calculate plusTip using tip and price;
---
Output plusTip;
---
Close main()
You have about three hours and fifteen minutes of homework to do today. Rather than starting it right away, you choose to procrastinate by calculating how many seconds youβll be spending on your work. Convert the time to seconds and store the result in seconds. Be sure to inclue any necessary headers.
Write code that calculates and prints the average of a and b if a = 3.14, and b = 1.59. You may only use one line of code. Be sure to inclue any necessary headers.
Write code that calculates and prints the average of a and b if a = 3.14, and b = 1.59. You may only use one line of code. Use the lines on the to construct the pseudocode, then go back to complete the Activecode.