⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 find.cpp

📁 本人非常成功的c++课设
💻 CPP
字号:
#include<iostream.h>
#include<fstream.h>
#include<string.h>
#include"Word声明.h"
void ch_to_en();
void en_to_ch();
void Find()
{
	cout<<"*    *     *    *    *     *     *     *    *      *    *      *     *    *"<<endl;
	cout<<"汉译英(1)**英译汉(2)**退出(0)"<<endl;
	
	int i;
	cin>>i;
	while(i!=0)
	{
		switch(i)
		{
          
		   case 1:ch_to_en(); break;       ///汉译英
	       case 2:en_to_ch();    break;        //英译汉
	       default:cout<<"错误,请仔细输入"<<endl;     break;
		}
     cout<<"请输入您要选择的功能:"<<endl;
	 cout<<"*    *    *     *    *     *     *     *    *     *     *     *     *    *"<<endl;
     cout<<"汉译英(1)**英译汉(2)**退出(0)"<<endl;
	cin>>i;
	}
}
void ch_to_en()
{
	ifstream fin1("添加word.txt",ios::in);
	char zhong[40];
	cout<<"请输入中文"<<endl;
	cin>>zhong;
	for(int k=0;!fin1.eof();k++)
	{
        fin1>>wor1.english>>wor1.chines;
            
		if(strcmp(wor1.chines,zhong)==0)
		{
			cout<<"* * * * * * * * * * * * *查找成功!* * * * * * * * * * *"<<endl;
			
			cout<<wor1.chines<<wor1.english<<endl;
		  break;   
		}	
	}
	fin1.close();
}

void en_to_ch()
{
	ifstream fin1("添加word.txt",ios::in);
	char ying[40];
	cout<<"请输入请输入英文"<<endl;
	cin>>ying;
    for(int k=0;!fin1.eof();k++)
	{
        fin1>>wor1.english>>wor1.chines;
            
		if(strcmp(wor1.english,ying)==0)
		{
			cout<<"* * * * * * * * * * * * *查找成功!* * * * * * * * * * *"<<endl;
			
			cout<<wor1.english<<wor1.chines<<endl;
		  break;   
		}	
	}
	fin1.close();
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -