

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Some concept of Computers and Programming I are Assign Value, Single-Subscripted Array, Class Members, Current Precision, Elementary School, Complete Program, Fibonacci Sequence, Programming Errors. Main points of this homework are: Current Precision, Single Statement, Performs, Member Function, Current Precision, Digits, Precision, Manipulator, Hexadecimal, Decimal
Typology: Lecture notes
1 / 3
This page cannot be seen from the preview
Don't miss anything!


For each of the following, write a single statement that performs the indicated task.
Question 1 Print the current precision setting using a member function.
Question 2 Print 1.92, 1.25 and 1.9258 with 3 digits of precision using a manipulator
Question 3 Print integer 100 in octal, hexadecimal and decimal using stream manipulators.
Question 4 Print integer 100 in decimal, octal, and hexadecimal using a single stream manipulator to change the base.
Question 5 Print 1234 right-justified in a 10-digit field.
Question 6 Using integer variables x and y to specify the field width and precision used to display the double value 87.4573 and display the value.
Question 7 Write a program to test inputting integer values in decimal, octal and hexadecimal format. Output each integer read by the program in all three formats. Test the program with the following input data: 10, 010, 0X10.