Question
01. Which of the following items will not be recognized if iostream is not included in the program for the preprocessor? a. main b. std
01.
Which of the following items will not be recognized if iostream is not included in the program for the preprocessor?
a. | main | |
b. | std | |
c. | namespace | |
d. | cout |
02. When deciding the data type to use to declare a variable, we need to consider the possible values the variable might hold. Write a declaration of a variable named numberOfWidgets that can be used to hold numbers like 57 and 981 and -4.
03. Define two variables, num1 and num2.
Write an assignment statement that performs the following operation with the variables num1 and num2:
Divides num1 by 10.5 and stores the result in num2. Make sure there is no data loss.
04. Write a cout statement with stream manipulators that perform the following:
Display the constant PI in a field of eight spaces, in fixed-point notation, with four decimal places of precision.
05. As we know, the data type we assign to our variables is dependent on the values of the data the variable will hold. Given the following code:
int number;
number = 1.5;
06. Write an if statement that assigns 100 to x when y is greater than or equal to 0. Just write the if statement. You do not have to write a program.
07. Assume that the variable name has been declared for storing names. Write the code that reads a value into name and then prints the message "Greetings, NAME!!!" where NAME is replaced the value that was read into name. For example, if your code read in "Judy" it would print out "Greetings, Judy!!!".
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started