COS 126 Hello, World |
Programming Assignment 0 Due: Wednesday, 11:59pm |
The purpose of this assignment is to familiarize you with using the computer and with the mechanics of preparing and submitting assignment solutions. This assignment carries no grade, but you must do the electronic submission. Even if you're already a computer whiz, you might learn something! Your goal this week is to learn to use emacs for editing files, netscape for browsing the World Wide Web, lcc for compiling programs, and /u/cs126/bin/submit for submitting programs.
If you have programmed before, you may be able to finish this assignment quickly. If you have not programmed before, or if you are not familiar with the systems that we use, plan to learn the basics in the computer lab in room 101 in the CS building. There will be someone there to answer questions most of the time this week, and there will be help sessions in the evening. Don't be afraid to ask for help.Your assignment is to create, compile, and run the following extension of everybody's first C program (Kernighan and Ritchie, pp. 5-8).
#include <stdio.h> main() { int n; printf("Hello world! Give me a number:\n"); scanf("%d", &n); printf("Thanks! I've always been fond of %d\n", n); }
Completing this assignment involves the following steps.
in the Terminal window. Then nothing will happen. You must type a number (say, 5), and hit Enter, then you will getHello world! Give me a number:
and the program should terminate. You may need to repeat this edit-compile-execute cycle a few times before it all goes smoothly.Thanks! I've always been fond of 5
/u/cs126/bin/submit 0 hello.c
When you've finished this assignment, try out some of the other software you'll be using this semester. To browse the COS 126 Web pages, type
netscape http://www.cs.princeton.edu/courses/cs126/ &
You can also just type netscape &, click on netscape's Open button, and enter
http://www.cs.princeton.edu/courses/cs126/
in the pop-up dialog box. Cruise around the COS 126 Web; it is essential that you understand what's where and how to get to it.
You'll also use electronic mail a lot this semester. So, to get started, send electronic mail to cs126 telling us (briefly) whether or not you have previous programming experience, in which department at Princeton you might major, and anything else you'd like to say. If you've never used mail, type pine to get started, and ask for help if you get stuck.
To log out, position the mouse over the background, i.e., not over any windows, click the right mouse button, and select "Logout". Alternatively, you can just click the "EXIT" button in the Control Panel. Don't forget to log out!