<aside> 💡 Introduction Unlike last term, these notes will (probably) be very abstract and way less concise. 2024: NVM! It turned out to be one of the most detailed CS246 notes you can find out there (feel free to contribute to make it even better!)
Note: I don’t think this is a good primary source for directly learning CS246 (especially if you are new to C++), but rather a supplementary resource to accompany your studies as you take this course.
</aside>
Three perspectives
Hello World
import <iostream>
using namespace std;
int main(){
cout << "Hello World" << endl;
return 0;
}
Some IO notes:
Streams: It is an abstract type that represents a sequence/block of characters
I/O streams cout/cerr - stdout/stderr
cin
- reading from stdin
<<
- put to (stdout)
>>
- get from (stdout)
By default, cin
skips leading whitespace(space/tab/newline)
Implicit conversion from cin
's type(istream) to bool