# Homework 2, Setting Up Your Environment.

### Short Description:

Establish a basic working environment for the semester.

This assignment is worth 10 points.

### Goals

When you finish this homework, you should have:
• Set up a programming environment for the semester.
• Logged into cslab103.cs.edinboro.edu
• Entered, compiled, debugged and run a program.

### Formal Description

The purpose of this assignment is to get your environment set up for class. I would like you to create a program and use cslab103 to compile and execute that program.

We will discuss different environments in class, your job is to select one or two and make it work for you. This may be easy or it may be difficult. Please seek advice and assistance if you run into problems.

You will document your success in accomplishing this task by taking screen shots of the work in progress and pasting this in a word document.

1. Start a word document.
• Please use the word format, not pdf or any other document format.
• Microsoft office is available for all students
• You can use office on line.
• You can use an open source document editor which saves in word format.
• Place your name and identifying information in this document.
• You will answer questions and place screen shots in this document for the next section.
• Please make sure you label each step clearly before your response for each section.
2. Select at least one of the following options.
1. Windows, easy
• Install a text editor, I would suggest notepad++
• Install a file transfer program, I would suggest WinSCP
• Install a terminal emulator, I would suggest PuTTY.
2. Windows, more challenging
• Install an IDE such as Code::Blocks
• You will still need to compile your code on cslab103 before submission.
• Install a file transfer program, I would suggest WinSCP
• Install a terminal emulator, I would suggest PuTTY.
3. Windows other.
• Give visual code studio a try.
• I don't know completely what vsc supplies, you still might need putty and and winscp.
4. Linux, easy
• This assumes you have a linux setup at home.
• Install a text editor, I would suggest kate.
• Alternatively or additionally install an IDE like Code::Blocks
• Install a terminal editor, I use xterm, but any will do.
5. Linux, more challenging
• DO NOT WIPE OUT YOUR WINDOWS INSTALL for linux unless you are really committed to this.
• Install linux on a computer or virtual machine.
• Do all the steps above.
• DO NOT WIPE OUT YOUR WINDOWS INSTALL for linux unless you are really committed to this.
6. macOS
• I am not a mac user, but I would try the Linux, easy steps.
7. Some other option, please document how you plan to edit, compile and execute code on cslab103.
3. For each option YOU selected:
4. Type in the following program, replacing my name with yours.
• Call the file homework2.cpp
• /*
Homework 1.
By: Dan Bennett
*/

#include <iostream>
#include <string>

using namespace std;

int main() {
// Replace my name with your name.
// Make sure it is inside quotation marks.
string myName {"Dan Bennett"};

cout << "Hello this is " << myName
<< " and I can make code work." << endl;
return 0;
} 
• Take a screen shot of this, place it in your word document.
5. Compile this program on cslab103 with the following command
• g++ -o homework2 homework2.cpp
• I believe that there are no errors in the above code.
• If there are no errors, the compiler will report nothing
• [dbennett@cslab103 tmp]$g++ -o homework2 homework2.cpp [dbennett@cslab103 tmp]$ 
• If you create errors while typing the code, the compiler will tell you about where the error is
• [dbennett@cslab103 tmp]$g++ -o homework2 homework2.cpp homework2.cpp: In function 'int main()': homework2.cpp:16:5: error: expected ',' or ';' before 'cout' cout << "Hello this is " << myName ^~~~ [dbennett@cslab103 tmp]$ 
• In this case, I removed the ; homework2 the end of line 14 to cause this error.
• Make sure your code matches the above code.
• Fix and recompile until all errors are gone.
• Take a screen shot of this, place it in your word document.
6. Once all of the errors are removed, run the program on cslab103
• [dbennett@cslab103 tmp]$./homework2 Hello this is Dan Bennett and I can make code work. [dbennett@cslab103 tmp]$ 
• Take a screen shot of the code running on cslab103 and add this to your document.

### Some Resources

• Some Local guides for using the system.