Practice Problem 2: Hello World
Objective: To learn how to write, compile, execute, and turn in a C++ program
I showed you the following program in class:
/* Craig Persiko
hello.cpp
Simple Hello World program
*/
#include <iostream>
using namespace std;
int main()
{
cout << "Hello, World!\n"; // Display the string.
return 0;
}
Here is your assignment:
- Unlike other practice problems, you must each do this assignment for yourself (no group work).
- Your program should be exactly like the above program, except yours should have your name, the file's
name (like above), and "CS 110A Practice Problem 2" in the comment at the beginning, instead of my name.
- Make sure to compile your program (using g++ or the compiler of your choice), and then execute the
file produced by the compiler (using a.out or however you run your program).
- Turn in your source code and the test run showing how your program worked.
- You may use whichever compiler you wish, but I recommend you do this assignment on hills or another Linux machine,
in order to get some experience with this environment. Follow the instructions given in
class and in the
Computer Access and Use Information handout.
- Make sure to submit your homework on Insight, on the
Assignment page for Practice Problem 2.
Return to main CS 110A page