DOC PREVIEW
USC EE 450 - EE450-Discussion02-Fall-2016 (1)

This preview shows page 1-2-3-4-5-6-39-40-41-42-43-80-81-82-83-84-85 out of 85 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 85 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 85 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 85 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 85 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 85 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 85 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 85 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 85 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 85 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 85 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 85 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 85 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 85 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 85 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 85 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 85 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 85 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 85 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

EE450 Discussion #2 A Brief Introduction to Software Development in C++Outline n (S)FTP Clients q learn how you can upload/download files to/from a server n X-Window Clients q learn how you can execute remote commands in a Unix server n Introduction to programming in C/C++(S)FTP Clients § To transfer files from/to your local machine to/from Nunki use any of the following § WinSCP, FileZilla (Windows) § Cyberduck, FileZilla, Fetch (Mac) § FileZilla (Linux) § or any other (S)FTP client, scp command, etc § See http://www.usc.edu/its/sftp/ for more details § WARNING: DO NOT delete any files you DID NOT create on the server! § You might not be able to execute commands correctly.(S)FTP Clients Cont’d… FileZilla See here: http://itservices.usc.edu/sftp/filezilla/File Editors n To remotely edit files (e.g. your C/C++ source code) on Nunki q you can either use file editors such as “emacs”, or “vi” that come with your UNIX environment n http://itservices.usc.edu/unix/editors/vi/ n http://itservices.usc.edu/unix/editors/emacsreference/ q or, you can use an editor from inside the (S)FTP client you use (easier) n Use either the default editor that each (S)FTP client comes with n Or, a third party editor that you can download and open from inside the (S)FTP client q Notepad++, Sublime Text (Windows) q Xcode, Sublime Text (Mac) q GEdit, Kate, KEdit, etc (Linux)How to connect Remotely to Nunki n To execute remote commands on Nunki: n If you use Windows q You need to download, install and run X-Win and VPN on your computer n Open software.usc.edu in you web browser n Login using your USC username and password n Select your operating system n Download the latest X-Win and VPN n Install them both on your computer n Check http://itservices.usc.edu/unix/xservers/xwin32 for more info n Run and login to VPN, run X-Win, configure an SSH session for nunki and login to nunki n If X-Win does not work on your machine (e.g. if you use Win 8), you can q download MobaXTerm from http://mobaxterm.mobatek.net/download-home-edition.html q Or download Putty from software.usc.edu n If you use Mac or Linux q Just use the pre-installed “Terminal” application instead of X-Win q Run the command: ssh –X [email protected] n WARNING: Don’t delete any files you did not create from the server!How to connect Remotely to Nunki Cont’d… n XwinHow to connect Remotely to Nunki Cont’d… n Select SShHow to connect Remotely to Nunki Cont’d… § Fill out as in shownHow to connect Remotely to Nunki Cont’d…How to connect Remotely to Nunki Cont’d… n The new connection will be added to you connection list under My Connections n Select the connection n Click on the Launch button. n Enter the Username and the passwordHow to connect Remotely to Nunki Cont’d… • Now you can execute your UNIX commandHow to connect Remotely to Nunki Cont’d… n Putty nunki.usc.edu!Introduction to C/C++Strategies for learning C++ n Focus on concepts and programming techniques (Don’t get lost in language features) n Learn C++ to become a better programmer q More effective at designing and implementing n C++ supports many different programming styles n Learn C++ gradually n Don’t have to know every detail of C++ to write a good C++ program n Implement full working examples to see how they work q See also here: http://www.cplusplus.com/doc/tutorial/In a Nutshell: “Hello World” in C++ n Our first program in C++: “Hello World” /* my first program in C++ with comments */ #include <iostream> using namespace std; int main () { cout << "Hello World! "; // prints Hello World! return 0; } n After you are connected to Nunki, create a text file named “hello.cpp”, and copy-paste the source code shown above n In the command line, run: g++ hello.cpp q This generates an executable a.out. It can be executed with ./a.out n Alternatively, run: g++ -o somename hello.cpp q Run it with ./somename !Comments n How to make comments: n In C: q a = a+ b; /* comment in C */ n In C++: q a = a + b; // line comment q a = a + b; /*block comment block comment block comment*/Variable declaration n In C: all variable definitions must occur at the beginning of a block. q Example: int i; for (i=0; i<5; i++) { ... } n In C++: variable definitions may occur at the point of use. q Example: for(int i=0; i<5; i++) { ... }Identifiers n C++ reserved keywords that can not be used as an identifier: n asm, auto, bool, break, case, catch, char, class, const, const_cast, continue, default, delete, do, double, dynamic_cast, else, enum, explicit, extern, false, float, for, friend, goto, if, inline, int, long, mutable, namespace, new, operator, private, protected, public, register, reinterpret_cast, return, short, signed, sizeof, static, static_cast, struct, switch, template, this, throw, true, try, typedef, typeid, typename, union, unsigned, using, virtual, void, volatile, wchar_t. n and, and_eq, bitand, bitor, compl, not, not_eq, or, or_eq, xor, xor_eq. n far, huge, near (for some compiler).Boolean n Built-in type bool: n In C: true is represented by nonzero integer values, and false by zero. n In C++: type bool is added to represent boolean values. A bool object can be assigned the literal value true and falseBoolean n Example: n int* f (int); n bool flag1, flag2; n flag1 = false; n flag2 = f(5); n A zero value or a null pointer value can be converted to false implicitly; all other values are converted to trueConstant n In C: Constants are handled by the preprocessor through macro substitution. q #define MAX 10 q #define MAX f(5) // wrong !Declared Constants n In C++: The keyword const allows explicit definition of constants objects. n // max and a cannot be modified after initialization n const int max = 10; n const int a = f(5); n


View Full Document

USC EE 450 - EE450-Discussion02-Fall-2016 (1)

Download EE450-Discussion02-Fall-2016 (1)
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view EE450-Discussion02-Fall-2016 (1) and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view EE450-Discussion02-Fall-2016 (1) 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?