Listing 1: <tt>mquiz0.c</tt>




Document: Software Engineering 1: Lab Exercises

next Listing 2: circle0.c
up Software Engineering 1: Laboratory Exercises
gif Copyright

Listing 1: mquiz0.c

#include <safec.h>

viod Main(void)
{
  string_type albums;
  string_type name;
  boolean_type asking;

  put_string("Welcome to mquiz0!\n");
  put_string("What is your name?\n");
  get_string(name);
  put_string("Hello ");
  put_string(name);

  asking = TRUE;
  while (asking)
  {
    put_string("Here is your question:\n")
    put_string("What was the best album of all time?\n");
    get_string(album);
    if (string_equal(album, "Dark Side of the Moon\n"))
      put_string("Yes - you are obviously an expert!\n);
      ask = FALSE;
    else
      put string("No - don't you know *anything*?\n");
  }
}



McMullin@eeng.dcu.ie
Tue Apr 30 14:15:37 GMT 1996