Feb 20 In-Class

Contents

Feb 20 In-Class#

Note

There are no wrong answers. This is for participation credit, and is intended to let me know how well we understand the material at this point.

Access the form: https://forms.gle/KfDbUCByT7zqcERB7

Question 1#

We’ve written a “Hello World” program a number of times. Without looking back through the notes, write a simple C++ program that outputs “Hello, World” to the screen.

solution

Our basic “Hello, World” program is:

#include <iostream>

int main() {
    std::cout << "Hello, World" << std::endl;
}

Some comments:

  • Statements end with semicolons

  • << is the output stream operator, >> would be for input

  • echo is a Bash command, not C++

  • main has a type int, we must specify that.