160 likes | 272 Views
CS201 - Information. CS201 - Laboratories. All labs will be done using Linux on the PC’s or esus. All labs MUST use Makefiles. First lab is due NEXT WEEK at the end of your respective lab period. You will need to learn a Linux based text editor, such as pico, vim, or emacs.
E N D
CS201 - Laboratories • All labs will be done using Linux on the PC’s or esus. • All labs MUST use Makefiles. • First lab is due NEXT WEEK at the end of your respective lab period. • You will need to learn a Linux based text editor, such as pico, vim, or emacs.
CS201 – Help Sessions • With a few exceptions (e.g. 2/18), there will be a help session on Fridays in ROBH101 at 3:10 p.m. • This session will cover auxiliary material related to lecture and labs. For example, the first help session (1/14) will be on Linux, using a text editor, and compiling and running C programs
CS201 - Suggestions • Do the reading assignments BEFORE coming to lecture. • Take advantage of the exercises and self-tests in the text. • Review the lab assignments, design your solution, and do some preliminary coding BEFORE your lab period.
CS201 – esus accounts • You will need to have an esus account to login to Linux on the machines in EPS254. • Wait until you get your esus account to do lab #1. (No late penalties on this lab only).
CS201 - Enrichment • These are things that are not on the direct path of CS201 material but would be useful and interesting to advanced students. • No exam questions will be directly on enrichment topics. • C puzzles, additional lab procedures, or C++ related topics.
CS201 – Lab #1 – (1/18-1/19) • Boot the machine into Linux. • Login to the machine. • Use a text editor to build the “hello world” program. • Use a text editor to build a simple Makefile for the “hello world” program. • Using the Makefile, compile your program and run it. • Print out the Makefile and your source code file.
“hello world” C program /* helloworld.c * CS201 – S’05 – by (your name here) */ #include <stdio.h> int main(void) { printf(“Hello World!\n”); exit(0); }
helloworld Makefile # Makefile for helloworld # CS201 – S’05 by (your name here) helloworld: helloworld.o gcc –o helloworld helloworld.o helloworld.o: helloworld.c gcc –c helloworld.c
CS201 – sample make $ make gcc –c helloworld.c gcc –o helloworld helloworld.o $
CS201 – Sample run $ helloworld Hello World! $
CS201 – lab #1 enrichment • Try changing the helloworld program so it says “Happy New Year!” instead of “Hello World!”. • Try printing a line of astericks *************** before and after the “Happy New Year” message. • If you wanted to use the C++ compiler instead, replace gcc with g++.