Chap02 InputOutput and Operators P
Chap02 InputOutput and Operators P
C++ Programming
Input/Output and Operators
Write a C++ program that displays the message 'Welcome to C++!' on the
screen.
• Integer division (i.e., where both the numerator and the denominator are integers) yields
an integer quotient.
– Any fractional part in integer division is discarded (i.e., truncated)—no rounding occurs.
© 2016 Pearson Education GENG 2320 Engineering Software Fundamentals R. Rashidzadeh 7
2.6 Precedence of Arithmetic Operators
What happens when an int variable is assigned a value larger than the maximum limit of the int type in
C++?
3. A char variable in C++ can hold a single character and has a size of 2 bytes.
True / False
5- The bool data type can only hold true or false values.
True / False
6- In C++, the type modifier long is used to increase the storage size of data types like
_________ and _________.
• If the condition is true (i.e., the condition is met) the statement in the body of
the if statement is executed.
• If the condition is false (i.e., the condition isn’t met) the body statement is not
executed.
if ( grade >= 60 ) {
std::cout << "Passed\n" ;
} // end if
A is equal to B
A is not equal to B
A is less than B
A is greater than B
– Can write cout instead of std::cout, cin instead of std::cin and endl instead of
std::endl, respectively, in the remainder of the program.