CS 105 (C++)

Discussion 8
C++: Chapter 1, 2: OOP, C++ without classes

hello, world

There was a C++ version of the classic first program in the reading (p.12), but there are a couple of minor changes necessary to make it run in real life (or at least on our department UNIX machines).

Here's the final, working version (with details of the changes listed below):

#include <iostream>

using namespace std;

main() {
  cout << "hello, world\n";

(This is compiled as with previous examples, but using g++ instead of cc.)

So, what's different from the example in the book?

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.