Conclusion
Session 3: Week 6/7: Introducing C
Exercise 1: Hello World! (60%)
Here is the program insult.c introduced in the lectures:
#include <safe-c.h>
void main(void)
{
string_type s;
put_string("Welcome to INSULT!\n");
put_string("What is your name?\n");
get_string(s);
if (string_equal(s, "Barry\n"))
put_string("Hi, smarty pants!\n");
else
put_string("oooh - I don't like *you*!!!\n");
put_string("Bye bye from INSULT...\n");
}
Using this as a basis, or template, develop (plan, code, test, correct) a program called sport.c which will behave as follows: