01 Outline W1 W

Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

CS 354 - Machine Organization

Wednesday, September 7, 2016


We assume that you have successfully completed CS 302 and CS/ECE 252.
Waitlisted? Continue attending. Some seats open as students finalize their schedules.
Instructor
Jim Skrentny
[email protected]
5379 Computer Sciences
Lectures
Lecture 1: 113 Psychology, MWF: 1:20 PM - 2:10 PM
Lecture 2: 145 Birge, MWF: 2:25 PM - 3:15 PM
no lecture on 11/23 (Wed before TG)

Today
Course Intro
course info
exams & assignments
C Programming Intro
historical overview
first C program
edit-compile-run
Next Time
Read: finish K&R Ch. 1, review K&R Ch. 3 - 4
Basic C Programming

Copyright 2016 Jim Skrentny

CS 354 (F16): L1 - 1

Course Information
Canvas Course Website
UWs new Learning Management System
https://canvas.wisc.edu/courses/3949
will have outlines, assignments, announcements, Piazza, policies, etc
provides access to scores, class statistics, solutions
Textbooks and Readings
Computer Systems: A Programmer's Perspective, Bryant & O'Hallaron, 2nd Ed, 2010
The C Programming Language, Kernighan & Ritchie , 2nd Ed., 1988
 first page of each lecture outline has reminders of what to be reading
Lecture & Outlines
do assigned textbook readings before lecture
print and bring to lecture the outlines posted on the course Canvas page
outlines will usually be posted by 11 AM the morning of lecture
fill in outlines with your notes during lecture
Piazza Discussions
search and ask/answer questions about:
- homeworks and projects
- course content and logistics
- exams
must activate your Piazza account
CS Account
provides access to Linux lab computers with C programming tools
uses Ubuntu 14.02 LTS replaces Redhat Enterprise Linux 6
should be same user name/password as your 302 account
if new - must activate your CS account (see lab consulting)
is needed for your CS 354 student folder used for some course projects
TA Consulting
provides help with course topics, C tools and language, homeworks and projects
located in 1366 CS (other Linux labs 1355, 1358, 1368)
schedule is on Canvas (updated as the semester progresses)
 TA consulting starts today, 9/7, 5:30 7 PM

Copyright 2016 Jim Skrentny

CS 354 (F16): L1 - 2

Exams & Assignments


Exams (55%)

Midterm (25%):
Final (30%):

Thursday, October 27th,


Friday, December 23rd,

7:15 pm to 9:15 pm
2:45 PM to 4:45 PM

Notify us next week if you have a conflict with either of these exams.
Ill say more about this next week.
Projects (30%)

6 projects, 3-8% each, posted on Canvas


about two weeks to complete each
pair programming is allowed for some projects
submitted electronically via Canvas
accepted late only if
- extenuating circumstances are beyond your control
- you notify me at least 3 days prior to due date
- work can be completed in a few extra days

Homeworks (15%)

10 homeworks, 1.5% each, posted on Canvas


about one week to complete each
no collaboration allowed
submitted electronically via Canvas
not accepted late

Copyright 2016 Jim Skrentny

CS 354 (F16): L1 - 3

First C Program

int main(
{

char *str = malloc(50);


printf("Enter your CS login: ");
if (fgets (str, 50, stdin) == NULL) {
fprintf(stderr, "Error reading user input.\n");
}

int len = strlen(str);


if (str[len - 1] == '\n') {
str[len - 1] = '\0';
}

printf("Your login: %s\n", str);

Copyright 2016 Jim Skrentny

CS 354 (F16): L1 - 4

Building Your First C Program

Edit:

Compile:

Run:

Copyright 2016 Jim Skrentny

CS 354 (F16): L1 - 5

First C Program COMPLETE


/* title: First C Program
* file:
prog1.c
* author: Jim Skrentny
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

// for printf fprintf fgets


// for malloc
// for strlen

int main(int argc, char *argv[])


{
// Prompt and read user's CS login
char *str = malloc(50);
printf("Enter your CS login: ");
if (fgets (str, 50, stdin) == NULL) {
fprintf(stderr, "Error reading user input.\n");
}
// Terminate the string
int len = strlen(str);
if (str[len - 1] == '\n') {
str[len - 1] = '\0';
}
// Print out the CS login
printf("Your login: %s\n", str);
return 0;
}

Copyright 2016 Jim Skrentny

CS 354 (F16): L1 - 6

You might also like