C++

Проверка правильности перевода слов

#include <iostream>
#include <fstream>
#include <string>
#include <windows.h>
#include <cstdlib>
#include <ctime>

using namespace std;

int main () {
	setlocale(0, "");
	string line_1, line_2, arr1[100], arr2[100], a;
	int i,j,n;
	int vibor=0;
	cout << "Добро пожаловать в программу для заучивания слов,\nдля начала выберите пункт \"Новая игра\""<<endl;
m1:	cout << "Главное меню\n"<< endl;
	cout << "1. Новая игра\n2. Выход"<<endl;
	vibor=0;
	cin >> vibor;
	switch (vibor) {
		case 1: cout <<"Вы выбрали новую игру.\n"; break;
		case 2: system("cls"); cout <<"До свидания!\n"; system("pause"); exit(0); break;
		default: cout <<"В меню нет такого пункта. Введите еще раз:\n"; goto m1;
	}
	i=0;
	j=0;
	system ("cls");
	ifstream myfile1 ("eng.txt");
	if (myfile1.is_open())
	{
		while (myfile1.good() )
		{
			getline (myfile1,line_1);
			arr1[i]=line_1;
			i++;
		}
		myfile1.close ();
	}
	
	else cout << "Невозможно открыть файл с словами";
	
	
	ifstream myfile2 ("rus.txt");
	if (myfile2.is_open())
	{
		while (myfile2.good() )
		{
			getline (myfile2,line_2);
			arr2[j]=line_2;
			j++;
		}
		myfile2.close ();
	}
	
	else cout << "Невозможно открыть файл с словами";
	
	
	string cont;
m:
	srand( time(0) );
	n=rand() % 100;
	cout << "Переведите это слово: " << arr1[n] <<endl;
	cin >> a;
	if (a=="pause") goto m3;
	if (a==arr2[n]) cout << "Правильный ответ" << endl;
	else cout << "Неверный ответ" << endl;
	goto m;
m3:	cout << "Хотите продолжить? \n (y/n): " ;
	cin >> cont;
	if (cont == "y") goto m;
	if (cont == "n") goto m4; 
	else goto m3;
m4:	cout << "Выйти в главное меню?\n (y/n): ";
	cin >> cont;
	if (cont == "y") {
		system ("cls");
		goto m1;
	}
	if (cont == "n") goto m3; 
	else goto m4;

	system ("pause");
	return 0;
}
Добавлено: 11 Мая 2014 11:25:54 Добавил: Андрей Ковальчук Нравится 0
Добавить
Комментарии:
Нету комментариев для вывода...