Write a program that reads words from a text file and displays all the nonduplicate words in ascending order.

What will be an ideal response?


```
#include
#include
#include
#include
using namespace std;

int main()
{
string filename;
cout << "Enter a file name: ";
cin >> filename;

ifstream input(filename);

set s;
string word;
while (input >> word)
{
s.insert(word);
}

for (auto p = s.begin(); p != s.end(); p++)
{
cout << *p << " ";
}

// Alternatively, you can a foreach loop in C++11
for (string s: set)
cout << s << " ";

return 0;
}
```

Computer Science & Information Technology

You might also like to view...

Create a new binaryFind method in the Searcher class that works on any object of the type Comparable and takes a List of Comparable objects.

What will be an ideal response?

Computer Science & Information Technology

____ charts are also used to illustrate a company's market share in comparison to its competitors.

A. Column B. Bar C. Line D. Pie

Computer Science & Information Technology

FIGURE 7- 1Figure 7-1 above is a(n) ____.

A. flowchart B. truth table C. evaluation grid D. rule table

Computer Science & Information Technology

Describe the Federal Information Processing Standard.

What will be an ideal response?

Computer Science & Information Technology