COP 3275 COMPUTER PROGRAMMING USING C Instructor: Diego Rivera-Gutierrez...
-
Upload
terence-bruce-fitzgerald -
Category
Documents
-
view
337 -
download
2
Transcript of COP 3275 COMPUTER PROGRAMMING USING C Instructor: Diego Rivera-Gutierrez...
COP 3275 COMPUTER PROGRAMMING USING CInstructor: Diego Rivera-Gutierrez
[email protected] http://cise.ufl.edu/~djrg/
https://ufcprog2015.wordpress.com/
LET’S BACKTRACK A BIT!
• Did you guys register for a CISE account? • If not, do so soon! http://register.cise.ufl.edu/
• Why do we need an account?• All homework projects are expected to work on the
CISE Linux machines! • So, if your program doesn’t run, “But it works on my
laptop/computer” will not be an acceptable excuse!
SETTING UP YOUR PROGRAMMING ENVIRONMENT
SO HOW DO I ACCESS A COMPUTER TO TEST MY PROJECT?
• Multiple ways! (Once you have registered for an account)
1. You can always go to one of the CISE computer labs and login to your account there: https://www.cise.ufl.edu/help/access
2. You can do remote access to one of the servers.
QUICK POLL
CONNECTING TO A REMOTE TERMINAL
• Windows• Putty is your best option
• Mac OS• From a terminal you can always do SSH. To do so:
• Open a Terminal• Type: ssh <yourusername>@thunder.cise.ufl.edu• For example: [email protected]
UPLOADING FILES TO MY ACCOUNT
• Windows• WinSCP is your best option
• Mac OS• Any SFTP client will do• Options:
• Cyberduck• FileZilla
I’M IN A REMOTE TERMINAL… NOW
WHAT?• So you should see something to the effect of:
• The first word (thunder/storm) tells you which server• thunder.cise.ufl.edu and storm.cise.ufl.edu are both
available to you
• The number (22/25) is a “command number” and is pretty irrelevant
• What should I do next?
thunder:22%
storm:25%
RELEVANT COMMANDS• A list of useful commands is here: http://
www.computerhope.com/unix.htm
Command Function
man <command>
Provide manual for the command <command>
cd <directory> Change current directory/folder to <directory>
ls List contents of current directory
pwd Print working directory
mkdir <name> Make a new directory with the name <name>
cp <a> <b> Copy file <a> to location <b>
rm <file> Remove/Delete the file with name <file>
mv <a> <b> Move/Rename file <a> to location/name <b>
nano Open a file editor named nano(also known as pico)
nano <file> Open <file> with nano
cat <file> Outputs the contents of file to the terminal
BY FAR THE COMMANDS YOU WILL USE THE
MOST
Compiling commands Function
gcc <file>.c Compile the C program file with name <file>.c, use the generic output name a.out
gcc <file>.c –o <file>.out
Compile the C program file with name <file>.c, use the output name <file>.out
• We will discuss these two in more detail on Friday (gcc compiler)
• Now… what does <file>.c looks like? (AKA what did I get myself into by taking this class?)
LET’S WRITE A SIMPLE PROGRAM!
Notice: I’ll be using Notepad++ and pico/nano. You are free to use any IDE of your choosing, under two conditions:1) You will have to figure out how to use them on your own
(Neither me, nor Rahul the TA will be able to help you if you use an IDE we are not familiar with)
2) Your projects need to work correctly on the CISE servers using the compile lines we will provide.
THE HELLO WORLD PROGRAM
#include <stdio.h> int main(void) { printf("Hello World!"); return 0;}
THE EVEN BETTER “HELLO WORLD”
PROGRAM
#include <stdio.h> int main(void) { printf("Hello World!\n"); return 0;}
POTENTIAL CONTENT FOR REST OF THE
CLASS• Other escaped characters (\n,\\,\”, \t, etc)
• Data types: char, int, float.
• Variable declarations.
• Formatted printf