化学元素表背诵小助手

#include<bits/stdc++.h>
using namespace std;
//#define int long long
inline int read(){int x=0,f=1;char ch=getchar();
while(ch<'0'||ch>'9'){if(ch=='-')f=-1;
ch=getchar();}while(ch>='0'&&ch<='9'){x=(x<<1)+
(x<<3)+(ch^48);ch=getchar();}return x*f;}
#define Z(x) (x)*(x)
//#define M
//#define mo
//#define N
int n, m, i, j, k, T;
string c[20]={"1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20"}; 
string s[20]={"氢", "氦", "锂", "铍", "硼", "碳", "氮", "氧", "氟", "氖", "钠", "镁", "铝", "硅", "磷", "硫", "氯", "氩", "钾", "钙"}; 
string t[20]={"H", "He", "Li", "Be", "B", "C", "N", "O", "F", "Ne", "Na", "Mg", "Al", "Si", "P", "S", "Cl", "Ar", "K", "Ca"}; 
string str; 

int rd(int x, int u, int v)
{
	if(u==v) return x; 
	int y; 
	do{
		y=rand()%20; 
	}while(y==x); 
	return y; 
}

void wen(string c[20], string s[20])
{
	cout<<"请问 " << c[i] << " 对应的是:" << endl; 
	n=rand()%4; 
	cout<<"A. "<< s[rd(i, n, 0)] << "	"; 
	cout<<"B. "<< s[rd(i, n, 1)] << "	"; 
	cout<<"C. "<< s[rd(i, n, 2)] << "	"; 
	cout<<"D. "<< s[rd(i, n, 3)] << "	"; 
//	cout<<"E. "<< s[rd(i, n, 4)] << "	"; 
//	cout<<"F. "<< s[rd(i, n, 5)] << "	"; 
//	cout<<"G. "<< s[rd(i, n, 6)] << "	"; 
	cout<<endl; 
}

signed main()
{
//	freopen("tiaoshi.in", "r", stdin);
//	freopen("tiaoshi.out", "w", stdout);
	srand(time(NULL));
	cout<< "请开启大写锁定"  << endl; 
	while(1)
	{
		k=rand()%6; i=rand()%20; 
		if(k==0) wen(c, s); 
		if(k==1) wen(c, t); 
		if(k==2) wen(s, c); 
		if(k==3) wen(s, t); 
		if(k==4) wen(t, c); 
		if(k==5) wen(t, s); 
		cin>>str; 
		j=str[0]-'A'; 
		if(j==n) cout<<"恭喜你 ,答对了!"<<endl;  
		else  cout<<"答案错误... 正确答案为:" << (char)(n+'A') <<  endl;  
	}
	return 0;
}
posted @   zhangtingxi  阅读(16)  评论(0编辑  收藏  举报
编辑推荐:
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 展开说说关于C#中ORM框架的用法!
点击右上角即可分享
微信分享提示