CIS 201: Linux Shell Scripting

lewing@isc.tamu.edu

Gabelli School of Business, CIS Department

| CISWEB Doug White | RWU Main | White Hat Research | Email Doug | Access Data |

CIS 201: Lab 1.2

Getting Started with g++

This is a basic program that is required of everyone. You should turn it in for credit. Be sure and read the formatting instructions.

For this problem, you need to compile a simple C++ program using g++.\

commands are on lines which start with >

Open an editor in linux.

>sudo vim lab1-2.cpp

//vim starts in edit mode. Press i to enter insert mode. Press esc to return to edit mode

//in edit mode type :wq to save and exit. in edit mode type :w to save

//enter your base formats (see lab instructions)

//enter the following code

//begin program here

#include <iostream>

using namespace std;

int main ()

{

cout << "Hello World" << endl;

cout << "OOOOOOOO, AAAAAHHHHHHHH, and amazing c++ experience. " << endl;

return 0;

}

//end program here

//now hit esc, type :wq and save it.

//now compile it

>sudo g++ -o lab1-2 lab1-2.cpp

//this should return a prompt. If errors are generated, you mistyped something.

//make it executable

>sudo chmod 700 lab1-2

//now run it

>sudo ./lab1-2

 

 

 

| Contact | © 2005 Secure Technology, LLC. |