#include <iostream>
#include <vector>
#include <string>
#include <locale.h>
using namespace std;
int main(){
setlocale(LC_CTYPE, "Polish");
vector<string> cities;
cities.push_back("Kraków");
cities.push_back("Krasocin");
cities.push_back("Krzyszkowice");
cities.push_back("Kluczbork");
cities.push_back("Gdańsk");
string input;
cin >> input;
vector<string> temp;
for (int i = 0; temp.size() != 0 || i == 0; i++){
temp.clear();
for (int j = 0; j < cities.size(); j++){
cout << "input[i]: " << input[i] << ", cities[j]: " << cities[j] << ", cities[j][i]: " << cities[j][i]<< endl;
if (tolower(input[i]) == tolower(cities[j][i])) {
temp.push_back(cities[j]);
}
}
if (temp.size()){
cities = temp;
}
}
cout << "DID YOU MEAN:" << endl;
for (int i = 0; i < cities.size(); i++){
cout << "\t" << cities[i] << endl;
}
}
Paste Hosted With By Wklejamy.pl