Lab 1: Introduction To C++: Step 1: Run Devc++ and Create File
Lab 1: Introduction To C++: Step 1: Run Devc++ and Create File
Objectives:
Run the DevC++ from the Start Menu of the lab computer
In DevC++, create new C++ program: Click File >> New >> Source File from top menu. An
empty white text window should appear
Click the File >> Save As.. from the top menu.
The file name must end .cpp.
Any C (C++) program must be saved in a file with extension “.c” (“.cpp”).
File names should begin with lower case letters.
File names should limited up to 30 characters.
File names and directory paths should not contain blanks, parentheses “(”, or crazy characters.
Smallest non-empty C/C++ file, which is compilable, must have at least the main().
Step 3: Compile and run the program
Write the following code.
1 #include <iostream>
2 using namespace std;
3 // main () is where program execution begins.
4 int main ()
5 {
6 cout << "Hello World!" << endl;
7 return 0;
8 }
Click Execute >> Compile & Run from the top menu
Task 1: Trace the output for the following statements.
#include <iostream>
using namespace std;
int main ()
{
cout << "Hello " << "world, " << "again!" << endl;
cout << "hello," << endl << "one more time." << endl;
return 0;
}
int main()
{
cout << "Testing, testing" << endl;
cout << "one two three" << endl;
cout << endl;
#include
using std;
int main ();
{