微信号:jungobiao
#include<bits/stdc++.h>
#include <fstream>
using namespace std;
void regist(){
string name;
cout<<"账号:";
cin>>name;
int code;
cout<<endl;
cout<<"密码:";
cin>>code;
ofstream outfile("data2.txt",ios::binary|ios::app|ios::in|ios::out);
outfile<<name<<" "<<code;
outfile.close();
return ;
}
void login(){
ofstream outfile("data2.txt",ios::binary|ios::app|ios::in|ios::out);
ifstream fin("data2.txt");
string name,name_1;
int code,code_1;
fin>>name_1>>code_1;
cout<<"账号:";
cin>>name;
cout<<endl;
cout<<"密码:";
cin>>code_1;
if(name==name_1&&code==code_1){
cout<<"登入成功!"<<endl;
}else{
cout<<"账号或密码错误!"<<endl;
}
return ;
}
int main() {
int num=0;
cout<<"1.登录 2.注册"<<endl;
cin>>num;
if(num==2){
regist();
}else{
login();
}
return 0;
}
messagebox相关: 常量 按钮组合 返回值对应标识符
MB_OK 确定按钮 IDOK
MB_OKCANCEL 确定+取消 IDOK/IDCANCEL
MB_YESNO 是+否 IDYES/IDNO
MB_ABORTRETRYIGNORE 终止+重试+忽略
IDABORT/IDRETRY/IDIGNORE
图标类型常量
错误图标:MB_ICONERROR(红色X)
警告图标:MB_ICONWARNING(黄色三角)
问号图标:MB_ICONQUESTION(蓝色问号)
信息图标:MB_ICONINFORMATION(蓝色i)
#include<bits/stdc++.h>
#include<windows.h>
using namespace std;
struct player{
int life_limited,now_life;
int card_number,card[30];
}a[10];
void draw_cards(int time,int who){
for(int i=1;i<=time;i++)
a[who].card[a[who].card_number+i]=rand()%4+1;
a[who].card_number+=time;
}
void assignment(){
a[1].life_limited=4;
a[1].now_life=4;
draw_cards(4,1);
a[2].life_limited=4;
a[2].now_life=4;
draw_cards(4,2);
}
int main(){
system("cls");
string st;
while(1){
cin>>st;
if(st!="start"){
MessageBox(NULL, "请勿乱输 Please do not input randomly 请重新输入 Please re-enter", "警告warning", MB_OK);
}else{
break;
}
}
system("cls");
printf("loading");
for(int i=1;i<=15;i++){
printf("...");
Sleep(750);
if(i%3==0){
system("cls");
printf("loading");
}
}
return 0;
}
```language