Пытаюсь решить такую вот простенькую задачу:
Написать программу для распознания английских названий чисел. Примеры ввода
и вывода: «six» — 6. Числа от -20 до 20.
Но не выходит. Выдает завершение работы программы. Подскажите, что не так.
vector <int> ch= {-20,-19,-17,-16,-15,-14,-13,-12,-11,-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20};
vector <string> sl={"minus twenty","minus nineteen","minus eighteen","minus seventeen","minus sixteen","minus fiveteen","minus fourteen","minus thirdteen", "minus twelve","minus eleven", "minus ten","minus nine","minus eight","minus seven", "minus six","minus five","minus four"," minus three", "minus two", "minus one", "zero", "one","two","three","four","five","six","seven" ,"eight","nine","ten","eleven","twelve","thirdteen","fourteen","fiveteen","sixteen","seventeen","eighteen","nineteen","twenty"};
int main(){
cout << "Vvedite chislo" <<endl;
for( int i: ch){
while(cin>> sl[i]){
sl[i]=ch[i];
cout << "Sootvetstvie s:" <<sl[i] <<endl;
}
}
return 0;
}