When you create your code - ensure you have the following:
Comment section:
Chapter and , Lab Number, Programming Language
Your Name
Created/Modified date
Purpose of program
Code Block |
---|
/* Chapter and Lab Number: Module 1, Lab 2, C++ Author: John Doe Date: July 12, 2023 Description: This file contains an example C++ program that demonstrates the usage of functions and arithmetic operations to calculate the sum of two numbers and display the result. */ |
...
Code Block | ||
---|---|---|
| ||
// Module 1 Demo, C++ // Author: Sam Student // Created on 1-9-2023. // Demonstrate output and create new lines // Code uses \n and endl |
These lines are comments in the code. In C++, comments that begin with //
are single-line comments. They're not executed as part of the code, but they provide information or context to readers. Here, the comments are giving information about the code's purpose, the author, the creation date, and the specific features demonstrated as well as the language the file is written in (it is also acceptable to use the file name and extension - Example main.cpp)
Code Block | ||
---|---|---|
| ||
#include <iostream> // required library |
...