Explicit type conversion for fundamental types just

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 3 Lecture 10 Helena Wong / CS2331 Problem Solving and Programming (10-11 Sem A) Lecture Demo Exercises Question 1. Explicit type conversion for fundamental types (just like using a conversion constructor / Lecture09.pdf page 7) Syntax: simple-type-name ( expression ) Useful: We can convert fundamental values to the wanted types like: int totMarks=533; int totCourses=7; cout << "Average is : " << double(totMarks)/totCourses << endl; Your task: The program on the right attempts to read a letter and then show the next char (not the code) in the ASCII table. However, it gives wrong output. Fix it. char c; cout << "Input a letter: "; cin >> c; cout << "The next letter in ASCII is: " <...
View Full Document

This document was uploaded on 10/15/2013.

Ask a homework question - tutors are online