aboutsummaryrefslogtreecommitdiffstats
path: root/RealEstate.cpp
blob: 5f69c91ee6e98b2f5300eef670fe4af25d3df9ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
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);
}