Presentation is loading. Please wait.

Presentation is loading. Please wait.

ENGR 3 rocks. Your friendly TA Damon Good list of VI commands Good online free guide to Linux (time-sucker)

Similar presentations


Presentation on theme: "ENGR 3 rocks. Your friendly TA Damon Good list of VI commands Good online free guide to Linux (time-sucker)"— Presentation transcript:

1 ENGR 3 rocks

2 Your friendly TA Damon

3 Good list of VI commands http://ourldsfamily.com/mypapers/vi.html Good online free guide to Linux (time-sucker) http://www.linux.org/lessons/beginner/toc.html Good online free guide to C commands http://www.cs.cf.ac.uk/Dave/C/CE.html

4 To search these websites use Google in the following way tcsh site:http://www.linux.org or printf site:www.cs.cf.ac.uk/Dave/C

5 Homework 7 Let’s get ‘er done. A quick example: Ask user to enter an integer. Make C determine if the integer is even or odd. Tell the user if it is even or odd. If the user entered zero, warn them about it.

6 /*A prorgram that determines if an integer is even or odd.*/ #include int main() { int integer; printf( "\nEnter an integer: " ); scanf( "%d", &integer ); /*If the user entered 0 then give error*/ if ( integer == 0 ) { printf(“Warning: Evenness of zero is disputed.\n"); return 1; }

7 /*use mod to determine if the integer is even*/ /*if the integer is divisible by 2 then it is even*/ if ( integer % 2 == 0 ) { printf( "It is an even integer.\n"); }/*if integer is not divisible by 2 then it must be odd*/ else { printf( "It is an odd integer.\n"); } return 0; }

8 % gcc evenodd.c -o evenodd.out % evenodd.out Enter an integer: 34.4 It is an even integer. % evenodd.out Enter an integer: 0 Warning: Evenness of zero is disputed.

9 Time to work on Homework 7.


Download ppt "ENGR 3 rocks. Your friendly TA Damon Good list of VI commands Good online free guide to Linux (time-sucker)"

Similar presentations


Ads by Google