I. Installing and Running a C Compiler or IDE A. Compiler ------------------------------------------ INTERPRETERS VS. COMPILERS (source program) -----------> output interpreter (Source program) | | compiler | v [exectuable] ----------> output machine ADVANTAGES OF COMPILERS/INTERPRETERS compilers (C) interpreters (Python) code runs faster development cycle ~10 times faster programs smaller than compiled code ------------------------------------------ B. Downloading Code::Blocks for your machine ------------------------------------------ INSTALLING CODE::BLOCKS ON YOUR OWN MACHINE First, install MingW's gcc from http://www.mingw.org Then, install Code::Blocks from http://www.codeblocks.org/downloads See running_c.shtml for details ------------------------------------------ ------------------------------------------ USING CODE::BLOCKS Run Code::Blocks pin it to your taskbar From the File menu, create a project... ------------------------------------------ C. Using gcc from Eustis ------------------------------------------ YOU CAN USE GCC AT UCF Use the eustis.eecs.ucf.edu system login: your nid password: defaults to Pyymmdd where yymmdd is your birth year (yy) birth month (mm), and birth date (dd) Use a ssh client like putty http://www.chiark.greenend.org.uk/ ~sgtatham/putty/download.html Run the command gcc myprog.c -o myprog at the shell's prompt ------------------------------------------ II. Friday Problems A. installation ------------------------------------------ FOR YOU TO DO Install Code::Blocks on your machine See http://www.cs.ucf.edu/~leavens/COP3223H/running_c.shtml 1. http://www.mingw.org/ 2. http://www.codeblocks.org/ ------------------------------------------ B. I/O in C ------------------------------------------ FOR YOU TO DO Make a console application in C that prompts for a name (on stdout) and reads a name from stdin and prints: Hello, NAME! on stdout, where NAME is replaced by the name input. For example: name? Gary Hello, Gary! name? Veronica Hello, Veronica Do this by putting the following lines in order (and indenting them): #include return EXIT_SUCCESS } #include { scanf("%50s", name); char name[BUFSIZE]; printf("Hello, %s\n", name) printf("name? "); #define BUFSIZE 51 ------------------------------------------ C. variables in C ------------------------------------------ FOR YOU TO DO Write a C program that reads two numbers from stdin and prints their sum on stdout. Do this by arranging the following lines in order with proper indentation. printf("The sum is %d\n", x+y); #define BUFSIZE 51 #include int x; int readint() { scanf("%d", &i); int y; } y = readint(); printf("integer? "); #include return EXIT_SUCCESS; x = readint(); return i; int i; } int main() { ------------------------------------------