1 / 11

Homework 4 revision

Homework 4 revision. For this part: Explain how you could do this problem if the social security number is read instead as a longint. You can use the digits in reverse order. I realized you have not learned how to do it as stated yet. Don’t do the program - just explain.

kenny
Download Presentation

Homework 4 revision

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. Homework 4 revision • For this part: • Explain how you could do this problem if the social security number is read instead as a longint. • You can use the digits in reverse order. I realized you have not learned how to do it as stated yet. • Don’t do the program - just explain

  2. HW 4 revision (con’t) • If ss# is 987654321 your output would be:9:999999999 8:88888888 7:7777777 6:666666 5:55555 4:4444 3:333 2:22 1:1

  3. More nested loop examples

  4. Turbo Pascal Topic: Debugging

  5. Standard Functions: arithmetic • Sqr(x): squares x • sqrt(x): positive square root of x • abs(x): absolute value of x • exp(x): raises e to x power • ln(x): log of x to base e • cos(x): Cosine of x • sin(x): Sine of x • arctan(x): Arctangent of x

  6. More standard functions • Transfer functions (real to integer) • Round(x) rounds x to the closest integer • trunc (x) drops the part of x to the right of the decimal. • Boolean functions • odd (x) returns TRUE if x is odd or FALSE if x is not • we will learn others later

  7. Turbo Pascal non-standard functions • Pi: the value of pi (note: no arguments) • upcase(L): returns uppercase for a lowercase letter L. For any other character it returns the same character. • Frac(x): returns part to the right of the decimal • int(x): returns part to the left of the decimal • random(N): returns random integer between 0 and N-1 • random: returns random real between 0 & 1

  8. Midterm topics • Variables • types • integers • reals • boolean • character • strings • rules for naming • garbage values

  9. Midterm topics (con’t) • Arithmetic operators • integers • reals • precedence • formatting output - all types • reading data • buffer • all types

  10. Midterm topics (con’t) • Units • compiler • loops • FOR TO • FOR DOWNTO • nested • ordinal types - all topics

  11. Midterm topics (con’t) • Programming • any topic covered in • class • homework • chapters 1-5 • functions

More Related