CSC 1100 Lecture Notes - Lecture 7: Business Rule, Newline

41 views2 pages
CSC 1100 Lecture 7
Notes
C++ output to printer:
o Pdf
o LPT
o PRN
o Winprint
C++ functions
o A function is a group set of statements to perform some task
o Functions provided in C++ are organized into libraries that we may include in our
applications
o A function call is indicated by its name followed by paracenteses enclosing one
or more arguments
o cin.get
reads exactly one character from the input buffer
syntax
cin.get(<char-variable>)
o <char-variable> holds the character read
Example
o cin.get(c)
o cin.peek
used to look ahead in the input buffer
syntax
cin.peek()
reads the next character in the input buffer but does not remove it from
the buffer
in windows, the newline character is represented in the input stream as a
two-character sequence
o getline
used to read an entire string (including spaces and tab characters) from
input buffer
syntax
getline(cin,<string-variable>)
o <string-variable> holds the string read
Reads through the next/return character and removes it from the input
buffer
o cin.ignore
scans past the next <integer-expression> characters or through next
<char-expression>, whichever comes first
find more resources at oneclass.com
find more resources at oneclass.com
Unlock document

This preview shows half of the first page of the document.
Unlock all 2 pages and 3 million more documents.

Already have an account? Log in

Get OneClass Notes+

Unlimited access to class notes and textbook notes.

YearlyBest Value
75% OFF
$8 USD/m
Monthly
$30 USD/m
You will be charged $96 USD upfront and auto renewed at the end of each cycle. You may cancel anytime under Payment Settings. For more information, see our Terms and Privacy.
Payments are encrypted using 256-bit SSL. Powered by Stripe.