dos_compilers/Borland Turbo C++ v1/EXAMPLES/EX5.CPP
2024-07-02 07:34:51 -07:00

23 lines
635 B
C++
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// ex5.cpp: Using the Definition class
// from Chapter 6 of User's Guide
#include <iostream.h>
#include "def.h"
main()
{
Definition d; // Declare a Definition object
char s[81];
// Assign the meanings
d.put_word("class");
d.add_meaning("a body of students meeting together to \
study the same subject");
d.add_meaning("a group sharing the same economic status");
d.add_meaning("a group, set or kind sharing the same attributes");
// Print them
cout << d.get_word(s) << ":\n\n";
for (int i = 0; d.get_meaning(i,s) != 0; ++i)
cout << (i+1) << ": " << s << "\n";
}