08 lecture

08 lecture - -use setw to set width of column...

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

View Full Document Right Arrow Icon
mixing cin and getline: cin: skips leading white space, reads target, leaves trailing white space getline: accepts everything until it sees new line character (\n), then removes the \n Formatting output: #include <iomanip> setw: set width, used to set coloum length setprecision: used to establish how many digits you want to use fixed: another tool for determining how many digits you want to use -defalt format shows that it will round your number at the 6th place -that number of digits can be changed with: cout<<setprecision(number of desired digits)<<. .... -use fixed to specify # of digits after a decimal instead of digits total cout<<fixed<<setprecision (number of desired digits passed the decimal point)
Background image of page 1

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

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

Unformatted text preview: -use setw to set width of column cout<<set(8)<< "hello"; this will automatically right justify it Objects:- a class is a user determined data type- an object is a a member of a class int is a data type. int and doubles are 'primitive' data types and are not classes.-objects have data fields. object fields contain primitive or object data Example: Class employee-an employee object has two fields: a string (name) a double (salary) construction: Class_name obj_name= class_name (parameters); or class_name obj_name (parameters; member function call: obj_name.mem_func_name (parameter);...
View Full Document

This note was uploaded on 05/19/2008 for the course PIC 10A taught by Professor Wittman during the Spring '08 term at UCLA.

Page1 / 2

08 lecture - -use setw to set width of column...

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