Assignments: * pushed back to Tuesday, 5pm. * submit as Google Doc, so that we can live update them into website
Midterm grades: * handed out on Thursday * email if you want them
Office hours * Link on course page.
Three languages:
Fortran
program add
implicit none
integer a,b,sum
read *, a,b
sum = a + b
print *,''
print *, ' The sum of ', a,' and ' , b, ' is ' , sum,'.'
print *,''
print *,'End of Program'
end program
Lisp
(defun add ()
(flet ((prompt (string)
(format t "~&~a: " string)
(finish-output)
(read nil 'eof nil)))
(let ((x (prompt "first number"))
(y (prompt "second number"))
)
(format t "~a" (+ x y)))))
COBOL
$ SET SOURCEFORMAT"FREE"
IDENTIFICATION DIVISION.
PROGRAM-ID. Iteration-If.
AUTHOR. Michael Coughlan.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 Num1 PIC 9 VALUE ZEROS.
01 Num2 PIC 9 VALUE ZEROS.
01 Result PIC 99 VALUE ZEROS.
01 Operator PIC X VALUE SPACE.
PROCEDURE DIVISION.
Calculator.
PERFORM 3 TIMES
DISPLAY "Enter First Number : " WITH NO ADVANCING
ACCEPT Num1
DISPLAY "Enter Second Number : " WITH NO ADVANCING
ACCEPT Num2
DISPLAY "Enter operator (+ or *) : " WITH NO ADVANCING
ACCEPT Operator
IF Operator = "+" THEN
ADD Num1, Num2 GIVING Result
END-IF
IF Operator = "*" THEN
MULTIPLY Num1 BY Num2 GIVING Result
END-IF
DISPLAY "Result is = ", Result
END-PERFORM.
STOP RUN.
Sabre today
SELECT gender, Discipline, year, degrees, degrees / (SUM(degrees) OVER (PARTITION BY year)) as PERCENT FROM
( SELECT year, Discipline, SUM(degrees) AS degrees, gender
FROM degrees WHERE AWLEVEL = 5 AND Discipline = 'Computer Science'
GROUP BY year, Discipline, gender
) AS totals
ORDER BY year, degrees
https://observablehq.com/@bmschmidt/cs-sql-21