COM SCI 31 Lecture Notes - Lecture 7: Newline, Royal Institute Of Technology, Undefined Behavior

42 views6 pages
15 Oct 2016
School

Document Summary

++n; we will not treat these as different for our purposes n ; . still use n, will have the value it had after last iteration . declare n outside, assign in for loop for (int n = 10; n >= 0; n ) cout << n << endl; output: 0 for test purposes, reduce number to something much smaller, like: test n = 3 instead of n = 1000 for (int n = 1; n < 1000; n *= 2) cout << n << endl; 512 int n = 1; while (n < 1000) cout << n << endl; n *= 2; equivalent! H e l l cout << (cid:281)enter some text: (cid:281) << endl; string s; getline(cin, s); for (int k = 0; k < . ; k++) write the kth character of s and then write a newline subscripts start at 0, not 1.

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents