Submit your solutions (source code) to the questions below by email to your instructor and TA(s) by Monday, October 17th (16:30).
Create a file named "hello_main_q1.cpp" and type the following code in it:
// hello_main_q1.cpp
#include <iostream> // stream declarations
int main()
{
int num = 1;
std::cout << "A " << num << "st C++ program" << std::endl;
}
Some comments:
Compile the program by typing on your shell ("$>" is the shell prompt):
$> g++ hello_main_q1.cpp -o hello_main_q1
Create a file "hello_main_q2.cpp" and rewrite the main function as follow:
// hello_main_q2.cpp
#include <iostream>
#include "display.h"
int main()
{
int num = 1;
display(num);
}
Now create the files "display.h" and "display.cpp".
Now compile all the files corresponding to this question to produce a binary named "hello_main_q2". Results of "hello_main_q2" and "hello_main_q1" should be identical.
Create files: "Date.h", "Date.cpp" and "test_date.cpp". In the file "Date.h", type the definition of the class Date seen in today's lecture (in the slides on separate compilation). Do not forget to add conditional directives to prevent multiple inclusion of the header "Date.h". In the file "Date.cpp", type the implementation of the class Date as seen in today's lecture. In the file "test_date.cpp", type the code for the main function testing our class Date as seen in today's lecture. Compile these files to produce a binary named: "test_date" and run it.