
Intensive Programming in Linux: CS288 with Instructor Christopher F. Yurkoski
Join CS288 for an intensive programming course in Linux with instructor Christopher F. Yurkoski. Explore topics like Test Review, Final Schedule, Bash Scripting, and Introduction to C. Get insights into project reviews and more. Don't miss the opportunity to enhance your skills in Linux programming.
Download Presentation

Please find below an Image/Link to download the presentation.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.
You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.
E N D
Presentation Transcript
Cs288 Intensive Programming in Linux Instructor: C F Yurkoski Christopher.f.yurkoski@njit.edu Section web site: https://web.njit.edu/~yurkowsk/cs288.html Class 6 6-9-15 2
Topics today Test revu Final schedule Project Revu Some last notes on bash Intro to C. Time for questions
Test Revu Written Revu Problem 12 Problem 13 Moodle would not let me assign grades over 100.
everyone (nothing)
true x
two 3
Problem12, average grade: 71% https://web.njit.edu/~yurkowsk/test1/makechecks grep -v "^hourly status" | grep "^hourly" | cut -f2,4 | while read data do temp=($data) count=${#temp[@]} hours=${temp[$count-1]} let pay=${hours}*${1} x=0 let namesize=$count-1 while [ $x -lt $namesize ] do echo -n "${temp[$x]} " let x=x+1 done echo -e \\t\$$pay done
Extra credit afsconnect1-111 test1 >: diff makechecks extracredit 15c15 < done --- > done | sort afsconnect1-112 test1 >:
Prob13 average grade 57% https://web.njit.edu/~yurkowsk/test1/getmany_twits: >: ./getmany_twits "Ernst" "Luther Strange" "Trump" Ernst @SenJoniErnst Luther Strange @SenatorStrange no twitter handle found for Trump >:
if [ $# != 1 ] then echo "Usage: $0 name" >&2 exit 1 fi twit=`wget -q -O - https://twitter.com/gov/lists/us-senate/members?lang=en | grep "@" | grep "$1" | cut -d"@" -f2 | cut -d"<" -f1` if [ "$twit" != "" ] then echo \@$twit else echo no twitter handle found for $1 >&2 exit 1 fi exit 0
Use \ to make long lines more readable while [ $# -gt 0 ] do twit=`wget -q -O - https://twitter.com/gov/lists/us- senate/members?lang=en | grep "@" | grep "$1" | cut -d"@" -f2 | cut -d"<" -f1` if [ "$twit" != "" ] then echo -e $1\\t \@$twit else echo no twitter handle found for $1 fi shift done
Final schedule The schedule can be downloaded at this link: https://www5.njit.edu/registrar/sites/registrar/files/finalexams-Sp17.csv 5/11/2017. 6:00 PM-8:30 PM GITC1400
Project revu https://web.njit.edu/~yurkowsk/x/projectone
6-9-15 cfy 19
6-9-15 cfy 21
6-9-15 cfy 22
6-9-15 cfy 23
Some final notes on bash IFS mkdir mv cp rm tail touch find man source
Some Basics of C Created by Dennis Ritchie of Bell Labs in the early 70s. 6-9-15 26
text 6-9-15 cfy 27
Tokens in C Keywords Identifiers Constants Strings Symbols Operators 6-9-15 28
Character Set Letters Digits Special characters 6-9-15 29
Identifiers Start with underscore or a letter Can contain letter, underscore and numbers Case sensitive Cannot be a keyword No longer limited in length 6-9-15 30
C keywords auto break case char const continue default do double else enum extern float for goto if int long register return short signed sizeof static struct typedef union unsigned void volatile while 6-9-15 31
Some Basic Types char int float short long double 6-9-15 32
char signed char Data types unsigned char short short int signed short signed short int unsigned short int unsigned short int signed signed int unsigned unsigned int long long int signed long signed long unsigned long unsigned long int long long float 6-9-15 33
Contants Integer range -32768 to +32767 Real expressed as mantissaeexponent e.g.: 12.3e4 range -3.4e38 to 3.4e38 char constants are ascii characters String contants- series of characters terminated by a null character. 6-9-15 34
Instructions Declaration I/O Arithmetic Control 6-9-15 35
Operators Arithmetic Relational Logical Bit-wise Assignment Conditional Increment and decrement 6-9-15 36
Arithmetic Operators + = * / % 6-9-15 37
Relational Operator > >= < <= == != 6-9-15 cfy 38
Logical Operators && || ! 6-9-15 39
Bitwise Operators* (complement, or, and, xor and shift) ~ | & ^ >> << *these cannot be used with floats 6-9-15 cfy 40
Increment & decrement ++ -- 6-9-15 cfy 41
Assignment Operators = += -= *= %= /= 6-9-15 cfy 42
Conditional Operator ? : exp1 ? exp2 : exp3 If exp1 is non-zero value of expression is exp2 otherwise it is exp3 1 ? 2 : 3 6-9-15 cfy 43
Operator Precedence left to right * / % + - 6-9-15 cfy 44
Some Basics /* Comments */ { blocks } Parameters ( ) # preprocessor directive Statements end with ; Loops: for while Conditionals if then 6-9-15 45
First program /* This is a comment */ #include <stdio.h> /* preproc d*/ main() { printf("hello world\n"); } 6-9-15 46
Basic printf formats %i or %d %c %f %s int char float string 6-9-15 cfy 47
Width and precision %d %6d %f %6f print as floating point, at least 6 characters wide %.2f print as floating point, 2 characters after decimal point print as decimal integer print as decimal integer, at least 6 characters wide print as floating point 6-9-15 cfy 48
I/O C=getchar(); putchar(C); 6-9-15 cfy 49
for statement for(init;condition;increment) { statement(s); } for(i=0;i<5;i++) { printf( %d\n ,i); } 6-9-15 cfy 50