0% found this document useful (0 votes)
37 views

Introduction To Computing Lab # 2: C++ Tool Learning

The document provides instructions for practicing C++ commands by creating a simple "Hello World" C++ program, compiling and running it using different commands in the command line, and renaming the files to test additional commands. The tasks include creating and saving a C++ file, adding code to print "Welcome to ITC class", compiling the code using g++, running the executable, and renaming files to test different compilation and execution commands. The document also provides links to download and install MinGW for compiling C++ programs on Windows systems.

Uploaded by

Ali Optimistic
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
37 views

Introduction To Computing Lab # 2: C++ Tool Learning

The document provides instructions for practicing C++ commands by creating a simple "Hello World" C++ program, compiling and running it using different commands in the command line, and renaming the files to test additional commands. The tasks include creating and saving a C++ file, adding code to print "Welcome to ITC class", compiling the code using g++, running the executable, and renaming files to test different compilation and execution commands. The document also provides links to download and install MinGW for compiling C++ programs on Windows systems.

Uploaded by

Ali Optimistic
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Introduction to Computing

Lab # 2: C++ Tool Learning


Question 1:

Practice the following:

a) Create an empty notepad file.


b) Save the above notepad file with the extension .cpp under a folder named ITC in desktop.
c) Copy and Paste the following text into above cpp file:

#include<iostream>
using namespace std;
int main()
{
cout<<"Welcome to ITC class";
return 0;
}
d) Open cmd and type in the command to move into ITC folder.
cd desktop
cd ITC
e) Tests the following Commands on the above cpp file:
1. g++ -c [yourfilename].cpp
2. g++ -o [yourfilename].exe [your filename].o
3. [yourfilename].exe
4. g++ -o [anyOthername].exe [your filename].o
5. [anyOthername].exe
6. Rename the above cpp file and execute the following command:
g++ -o [yourfilenewname].exe [yourfilenewname].cpp
7. [yourfilenewname].exe
8. Rename the above cpp file and execute the following command:
g++ [yourfilename].cpp -o [yourfilename].exe
9. [yourfilenewname].exe
10. Rename the above cpp file and execute the following command:
g++ [yourfilenewname].cpp
f) Run command to move back to the root directory on cmd.
g) Now run the above commands from 1 to 7 and if find issue then try to resolve.

Note: Download and Install MinGW on Your home PC using the following links below:

For windows 10:

http://www.codebind.com/cprogramming/install-mingw-windows-10-gcc/

For windows 7:

https://www.ics.uci.edu/~pattis/common/handouts/mingweclipse/mingw.html

You might also like