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

📄 add.cpp

📁 这是一个记忆单词的小系统 和电子词典的功能差不多 但是不用花钱买 对记忆单词特别有好处
💻 CPP
字号:
#include "1.h"

extern int n4;
extern int n6;
extern int nm;

void add(void)
{
x:
	cout<<endl<<endl<<endl;
	cout<<"                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"<<endl;
	cout<<"                      |         ~心 莹 背 单 词~         |"<<endl;
	cout<<"                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl<<endl<<endl<<endl;
	cout<<"                                 ~增~加~新~词~"<<endl<<endl;
	cout<<"                              1.增加到大学四级词汇"<<endl<<endl;
	cout<<"                              2.增加到大学六级词汇"<<endl<<endl;
	cout<<"                              3.增加到专业英语词汇"<<endl<<endl;
	cout<<"                              4. 返回上一层"<<endl<<endl;
	cout<<"                              5.    退出"<<endl;
	string g;
	cin>>g;
	system("cls");
	if (g=="1")
	{
C:
		cout<<endl<<endl<<endl;
    	cout<<"                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"<<endl;
    	cout<<"                      |         ~心 莹 背 单 词~         |"<<endl;
    	cout<<"                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl<<endl<<endl<<endl;
		cout<<"                           ~~欢迎您使用增加新词功能~~"<<endl<<endl;
		cout<<"                          您将增加新词在四级词库中, y/n?"<<endl<<endl;
		cout<<"                                     ";
		string b;
		cin>>b;
		system("cls");
		if(b=="y")    
		{
D:
			cout<<endl<<endl<<endl;
    	    cout<<"                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"<<endl;
        	cout<<"                      |         ~心 莹 背 单 词~         |"<<endl;
        	cout<<"                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl<<endl<<endl<<endl;
			cout<<"                            心莹背单词感谢您的使用"<<endl<<endl;
			cout<<"                    请输入您要增加的新单词以及它的汉语意思:"<<endl<<endl;
			cout<<"                                   ";
			string new4_e,new4_c;
			cin>>new4_e>>new4_c;
		    ofstream outlevel4("level4_word.txt",ios::app);
        	if (!outlevel4)
			{
	        	cerr<<"open error"<<endl;
	            exit(1);
			}
			outlevel4<<new4_e<<"  "<<new4_c<<"  ";   n4++;
E:
			cout<<"                   您已经成功增加了一个新词,是否继续添加.y/n?"<<endl<<endl;
			string c;
			cin>>c;
			system("cls");
			if(c=="y")   goto D;
			else if(c=="n")   welcome();
			else 
			{
				cout<<"                         您输入的信息错误,请重新输入......."<<endl;
				cout<<"                                请按回车键继续..."<<endl;
				while(!kbhit());
				getchar();
                goto E;
			}

			
			outlevel4.close();
			
			ofstream outnum_word("num_word4.txt",ios::out);
	        if (!outnum_word)
			{
	    	    cerr<<"open error"<<endl;
	            exit(1);
			}
			outnum_word<<n4;
			
	        outnum_word.close();                                              //统计单词数
		} 
		else if (b=="n")
		{
			cout<<"                        您已经取消了增加新词的操作,谢谢!";
			system("cls");
			entry();
		}
		else 
		{
			cout<<"                         您的输入有误,请重新输入......"<<endl;
			cout<<"                                请按回车键继续..."<<endl;
			while(!kbhit());
			getchar();
			system("cls");
			goto C;
		}

	}
	else if (g=="2")
	{
C1:
		cout<<endl<<endl<<endl;
    	cout<<"                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"<<endl;
    	cout<<"                      |         ~心 莹 背 单 词~         |"<<endl;
    	cout<<"                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl<<endl<<endl<<endl;
		cout<<"                           ~~欢迎您使用增加新词功能~~"<<endl<<endl;
		cout<<"                          您将增加新词在六级词库中, y/n?"<<endl<<endl;
		cout<<"                                     ";
		string b;
		cin>>b;
		system("cls");
		if(b=="y")    
		{
D1:
			cout<<endl<<endl<<endl;
    	    cout<<"                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"<<endl;
        	cout<<"                      |         ~心 莹 背 单 词~         |"<<endl;
        	cout<<"                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl<<endl<<endl<<endl;
			cout<<"                            心莹背单词感谢您的使用"<<endl<<endl;
			cout<<"                    请输入您要增加的新单词以及它的汉语意思:"<<endl<<endl;
			cout<<"                                   ";
			string new6_e,new6_c;
			cin>>new6_e>>new6_c;
		    ofstream outlevel6("level6_word.txt",ios::app);
        	if (!outlevel6)
			{
	        	cerr<<"open error"<<endl;
	            exit(1);
			}
			outlevel6<<new6_e<<"  "<<new6_c<<"  ";   n6++;
			outlevel6.close();
E1:
			cout<<"                   您已经成功增加了一个新词,是否继续添加.y/n?"<<endl<<endl;
			string c;
			cin>>c;
			system("cls");
			if(c=="y")   goto D1;
			else if(c=="n")   welcome();
			else 
			{
				cout<<"                         您输入的信息错误,请重新输入......."<<endl;
				cout<<"                                请按回车键继续..."<<endl;
				while(!kbhit());
				getchar();
                goto E1;
			}

			
			
			
			ofstream outnum_word("num_word6.txt",ios::out);
	        if (!outnum_word)
			{
	    	    cerr<<"open error"<<endl;
	            exit(1);
			}
			outnum_word<<n6;
			
	        outnum_word.close();                                              //统计单词数
		} 
		else if (b=="n")
		{
			cout<<"                        您已经取消了增加新词的操作,谢谢!";
			system("cls");
			entry();
		}
		else 
		{
			cout<<"                         您的输入有误,请重新输入......"<<endl;
			cout<<"                                请按回车键继续..."<<endl;
			while(!kbhit());
			getchar();
			system("cls");
			goto C1;
		}

	}
	else if (g=="3")
	{
C2:
		cout<<endl<<endl<<endl;
    	cout<<"                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"<<endl;
    	cout<<"                      |         ~心 莹 背 单 词~         |"<<endl;
    	cout<<"                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl<<endl<<endl<<endl;
		cout<<"                           ~~欢迎您使用增加新词功能~~"<<endl<<endl;
		cout<<"                          您将增加新词在专业英语词库中, y/n?"<<endl<<endl;
		cout<<"                                     ";
		string b;
		cin>>b;
		system("cls");
		if(b=="y")    
		{
D2:
			cout<<endl<<endl<<endl;
    	    cout<<"                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"<<endl;
        	cout<<"                      |         ~心 莹 背 单 词~         |"<<endl;
        	cout<<"                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl<<endl<<endl<<endl;
			cout<<"                            心莹背单词感谢您的使用"<<endl<<endl;
			cout<<"                    请输入您要增加的新单词以及它的汉语意思:"<<endl<<endl;
			cout<<"                                   ";
			string newm_e,newm_c;
			cin>>newm_e>>newm_c;
		    ofstream outlevelm("levelm_word.txt",ios::app);
        	if (!outlevelm)
			{
	        	cerr<<"open error"<<endl;
	            exit(1);
			}
			outlevelm<<newm_e<<"  "<<newm_c<<"  ";   nm++;
			outlevelm.close();
E2:
			cout<<"                   您已经成功增加了一个新词,是否继续添加.y/n?"<<endl<<endl;
			string c;
			cin>>c;
			system("cls");
			if(c=="y")   goto D2;
			else if(c=="n")   welcome();
			else 
			{
				cout<<"                         您输入的信息错误,请重新输入......."<<endl;
				cout<<"                                请按回车键继续..."<<endl;
				while(!kbhit());
				getchar();
                goto E2;
			}

			
			
			
			ofstream outnum_word("num_wordm.txt",ios::out);
	        if (!outnum_word)
			{
	    	    cerr<<"open error"<<endl;
	            exit(1);
			}
			outnum_word<<nm;
			
	        outnum_word.close();                                              //统计单词数
		} 
		else if (b=="n")
		{
			cout<<"                        您已经取消了增加新词的操作,谢谢!";
			system("cls");
			entry();
		}
		else 
		{
			cout<<"                         您的输入有误,请重新输入......"<<endl;
			cout<<"                                请按回车键继续..."<<endl;
			while(!kbhit());
			getchar();
			system("cls");
			goto C2;
		}

	}
	else if (g=="4")
	{
		entry();
	}
	else if (g=="5") exit();
	else 
	{
		cout<<"                         您输入的信息错误,请重新输入......."<<endl;
		cout<<"                                请按回车键继续..."<<endl;
		while(!kbhit());
		getchar();
		system("cls");
		goto x;
	}

}



⌨️ 快捷键说明

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