Previous section To contents

6.10 Simple exercises

  • Make a program that clones 10 hello world and then runs main() in each one of them.
  • Modify the register program to use an object for each record.
  • Modify the register program to use the following search function:
    void find_song(string title)
    {
        string name, song;
        int hits;

        title=lower_case(title);

        foreach(indices(records),name)
        {
            if(string song=records[name][title])
            {
                write(name+"; "+song+"\n");
                hits++;
            }
        }

        if(!hits) write("Not found.\n");
    }

  • Previous section To contents