Upgrade to Pro — share decks privately, control downloads, hide ads and more …

PLT-01 Misezan and Programming Paradigm

kanaya
April 27, 2024
56

PLT-01 Misezan and Programming Paradigm

kanaya

April 27, 2024
Tweet

Transcript

  1. pineapple.cc ݟͤࢉ Misezan w O👀O w O👀LLXIFSFOL w 👀 👀

    w 👀 👀 w 👀 👀 Math
  2. pineapple.cc ݟͤࢉ $ Misezan in C float gan(int a, int

    b) { if (a > b) { int c = a; a = b; b = c; } if (a == 6 && b == 9) { return 11.0; } else { if (a == 2 && b == 5) { return 1.1; } else { if (a == 1 && b == 100) { return 83.0; } else { if (a == b) { return 0.0; } else { return (float)b; } } } } } #include <stdio.h> int main(void) { printf(“%f\n”, gan(2, 5)); return 0; } C
  3. pineapple.cc ݟͤࢉ 1ZUIPO Misezan in Python def gan(a, b): if

    a > b: a, b = b, a if a == 6 and b == 9: return 11 elif a == 2 and b == 5: return 1.1 elif a == 1 and b == 100: return 83 elif a == b: return 0 else: return b print(gan(2, 5)) Python
  4. pineapple.cc ݟͤࢉ )BTLFMM Misezan in Haskell gan :: Int ->

    Int -> Float gan 6 9 = 11 gan 9 6 = 11 gan 2 5 = 1.1 gan 5 2 = 1.1 gan 1 100 = 83 gan 100 1 = 83 gan a b | a == b = 0 | a < b = fromIntegral b | a > b = fromIntegral a main :: IO () main = print $ gan 2 5 Haskell
  5. pineapple.cc ϓϩάϥϛϯάɾύϥμΠϜ Programming Paradigm w ௿ਫ४WTߴਫ४FHػցޠWT#BTJD w ඇߏ଄ԽWTߏ଄ԽFH'0353"/WT1BTDBM w ੩తܕ෇͚WTಈతܕ෇͚FH+BWBWT3VCZ

    w ඇΦϒδΣΫτࢦ޲WTΦϒδΣΫτࢦ޲FH$WT$  w ໋ྩܕWTؔ਺ܕFH1ZUIPOWT)BTLFMM w ࣮༻ܥWT೉ղܥFH+BWB4DSJQUWT8IJUFTQBDF
  6. pineapple.cc ੲͷϓϩάϥϛϯά Programming of old days 10 a = 1

    20 print “Hello.” 30 if a <= 10 then 40 print a 50 a = a + 1 60 goto 30 70 end if 80 end #include <stdio.h> int main(void) { int a = 1; loop: if (a <= 10) { printf("%d\n", a); a += 1; goto loop; } return 0; } Basic
  7. pineapple.cc ੲͷϓϩάϥϛϯά Programming of old days 10 a = 1

    20 print “Hello.” 30 if a <= 10 then 40 print a 50 a = a + 1 60 goto 30 70 end if 80 end #include <stdio.h> int main(void) { int a = 1; loop: if (a <= 10) { printf("%d\n", a); a += 1; goto loop; } return 0; } Basic ϥϕϧʢߦ൪߸ʣΛݟ͚ͨͩͰ͸ Ͳ͔͜Βδϟϯϓ͖͔ͯͨ͠Θ͔Βͳ͍
  8. pineapple.cc ੲͷϓϩάϥϛϯά Programming of old days program Sample; var a:

    integer; a := 1; while a <= 10 do begin WriteLn(a); a := a + 1 end. #include <stdio.h> int main(void) { int a = 1; while (a <= 10) { printf("%d\n", a); a += 1; } return 0; } Pascal
  9. pineapple.cc ߏ଄Խఆཧ Structured Program Theorem w ࿈઀ʢஞ࣮࣍ߦʣ w B C

    D  w બ୒ʢ৚݅෼ذʣ • if (p) { yes(); } else { no(); } w ܁ฦ͠ • while (p) { do_something(); } ࣍ճ༧ࠂ