Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <string>
- using namespace std;
- using std::cerr;
- #include <cstdlib> // for exit function
- #include "HashTable.h"
- void main ()
- {
- HashTable<string> ht (118619);
- string STRING;
- ifstream infile;
- infile.open ("dictionary.txt");
- if(!infile) { // file couldn't be opened
- cerr << "Error: file could not be opened" << endl;
- exit(1);
- }
- while(!infile.eof()) // To get you all the lines.
- {
- getline(infile,STRING); // Saves the line in STRING.
- hash;
- cout<<STRING; // Prints our STRING.
- }
- infile.close();
- system ("pause");
- infile.open ("document.txt");
- if(!infile) { // file couldn't be opened
- cerr << "Error: file could not be opened" << endl;
- exit(1);
- }
- while(!infile.eof()) // To get you all the lines.
- {
- getline(infile,STRING); // Saves the line in STRING.
- cout<<STRING; // Prints our STRING.
- }
- infile.close();
- system ("pause");
- }
- /*#include <iostream>
- using std::cerr;
- using std::cin;
- using std::cout;
- using std::endl;
- using std::string;
- #include <fstream>
- #include <string>
- using std::ifstream;
- #include <cstdlib> // for exit function
- // This program reads values from the file 'dictionary.txt'
- // and echoes them to the display until a negative value
- // is read. Borrowed from Deitel & Deitel.
- int main()
- {
- ifstream indata; // indata is like cin
- int num; // variable for input value
- string myString;
- indata.open("dictionary.txt"); // opens the file
- if(!indata) { // file couldn't be opened
- cerr << "Error: file could not be opened" << endl;
- exit(1);
- }
- // while ( !indata.eof() ) {cin.getline (ifstream, myString);} // keep reading until end-of-file
- indata.close();
- cout << "End-of-file reached.." << endl;
- return 0;
- }
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement