PracticeFinalExam

PracticeFinalExam - COSC1415/COSC1436 Final Exam Practice...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
COSC1415/COSC1436 Final Exam Practice Page 1 of 2 Practice Examples for C++ Final Exam Given the following data, what is stored in each variable. 5 3.2 1. cin >> int1 >> int2; 2. cin >> flt1 >> dbl2; 3. cin >> ch1 >> ch2; 4. cin >> str1 >> str2; 5. cin.get(ch1); cin.get(ch2); Assume num = 432.8746 What is the exact output of the following statements? 1. cout << setw(8) << setprecision(2) << num << endl; 2. cout << setw(10) << setprecision(3) << num << endl; 3. cout << setw(10) << setprecision(5) << num << endl; 4. cout << setw(1) << setprecision(1) << num << endl; Write the following functions with all documentation (/*in*/, /*out*/, /*inout*/, preconditions and postconditions). Write the function prototype and the function call. 1. if/value-returning function Write a value-returning function NumDigits that determines if a positive number is a one-digit number, a two-digit number, a three-digit number or a 4-digit number. The function should return a 1, 2, 3 or 4. You can assume the number is
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 2

PracticeFinalExam - COSC1415/COSC1436 Final Exam Practice...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online