如何将两个字符串接在一起?
#include<bits/stdc++.h> #include<windows.h>
#include<conio.h>
#define version "1.0"
#define ut 10000000ll
using namespace std;
string usernames,password,bankid,bankpassword;
int old;
string s;
long long money,EXP,happy,jie,expinf,bankmoney;
void delay(long long t)
{
for (int i=0;i<t;i++);
}
void welcome()
{
cout<<"城市生活 version"<<version<<" by WindowsC++工作室"<<endl;
delay(40*ut);
for (int i=0;i<=100;i++){
printf("加载中…… %d%%\r",i);
delay(2*ut);
}
delay(30*ut);
cout<<endl<<endl<<"加载完成!"<<endl;
delay(60*ut);
}
void print(string a)
{
for(int i=0;i<=a.length();++i)
{
cout<<a[i];
Sleep(25);
}
Sleep(1000);
return;
}
int main()
{
welcome();
system("cls");
void writelog();
writelog();
void signid();
signid();
return 0;
}
void writelog()
{
FILE*outlog=fopen("D:\\HappyGames\\CL\\1.0\\opentime.log","a");
time_t rawtime;
struct tm *ptminfo;
time(&rawtime);
ptminfo = localtime(&rawtime);
fprintf(outlog,"%02d-%02d-%02d %02d:%02d:%02d\n",ptminfo->tm_year + 1900, ptminfo->tm_mon + 1, ptminfo->tm_mday,ptminfo->tm_hour, ptminfo->tm_min, ptminfo->tm_sec);
}
void signid()
{
print("请输入账号,按“Enter”结束:\n");
getline( cin, s );
vector<string> users;
{
ifstream fin( "D:\\HappyGames\\CL\\1.0\\users.tmp" );
for( string user; getline(fin,user); )
users.push_back( user );
}
if( find(users.begin(),users.end(),s) != users.end() )
{
void signpassword();
signpassword();
}
else
{
cout << "对不起,该账号未注册!2秒后前往注册页面……";
}
}
void signpassword()
{
string defini="D:\\HappyGames\\CL\\1.0\\";
string defi="\\psaawords.tmp";
strcpy(defini,s);
strcpy(defini,defi);
print("请输入密码,按“Enter”结束:\n");
string sh;
getline( cin, sh );
vector<string> passwords;
{
ifstream passin( "D:\\HappyGames\\CL\\1.0\\passwords.tmp" );
for( string passwordss; getline(passin,passwordss); )
passwords.push_back(passwordss);
}
if( find(passwords.begin(),passwords.end(),s) != passwords.end() )
{
print("你好!");
print(s);
print("欢迎来到 城市生活!\n");
Sleep(250);
}
else
{
print("密码不匹配……");
}
}
[此贴子已经被作者于2018-9-22 12:05编辑过]