diff options
author | zedarider <ymherklotz@gmail.com> | 2016-02-18 11:37:45 +0000 |
---|---|---|
committer | zedarider <ymherklotz@gmail.com> | 2016-02-18 11:37:45 +0000 |
commit | af98ee7ff28cff97f5f29a5d9e65f9153531b0ee (patch) | |
tree | 86bfc53a0bc04512ac2936ee067a2b43e901e688 /RealEstate.cpp | |
download | imperial_2015-af98ee7ff28cff97f5f29a5d9e65f9153531b0ee.tar.gz imperial_2015-af98ee7ff28cff97f5f29a5d9e65f9153531b0ee.zip |
Imperial C++ Directory
These are all the projects I’ve been working on at university.
Diffstat (limited to 'RealEstate.cpp')
-rw-r--r-- | RealEstate.cpp | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/RealEstate.cpp b/RealEstate.cpp new file mode 100644 index 0000000..5f69c91 --- /dev/null +++ b/RealEstate.cpp @@ -0,0 +1,60 @@ +#include <iostream> +#include <vector> +#include <string> +#include <cstdlib> +#include <sstream> +#include <fstream> + +using namespace std; + +void check_string(); +// void translate(stringstream); + +struct dict_type { + string false_m, real_m; +}; + +void check_string() { + ifstream dict_file; + dict_type dict; + vector<string> false_statement, real_statement, words; + stringstream statement; + string word, original; + + dict_file.open("DictRealEstate.txt"); + if(dict_file.is_open()){ + cout << "open\n"; + while(dict_file >> dict.false_m >> dict.real_m) { + false_statement.push_back(dict.false_m); + real_statement.push_back(dict.real_m); + } + cout << "finished...\n"; + dict_file.close(); + } + + cout << "Enter Statement: "; + getline(cin, original); + statement << original; + + while(statement >> word) { + words.push_back(word); + } + + for(int i = 0; i < words.size(); i++) { + for(int j = 0; j < false_statement.size(); j++) { + if(words[i] == false_statement[j]) { + words[i] = real_statement[j]; + } + } + } + cout << "Translation: "; + for(int k = 0; k < words.size(); k++) { + cout << words[k] << " "; + } + cout << endl; +} + +int main() { + check_string(); + return(0); +}
\ No newline at end of file |