1 / 9

ENGR 3

ENGR 3. rocks. Your friendly TA Damon. 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.

rolf
Télécharger la présentation

ENGR 3

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. ENGR 3 rocks

  2. Your friendly TADamon

  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 commandshttp://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.orgor 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<stdio.h> 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.

More Related