枚举:
C++枚举输入;cin >> (int&)Com;
枚举的使用:
while (true)
{
switch (Com)
{
caseEMenu:
SelectMenu();
break;
caseEAddUser:
AddUser();
break;
caseEFindUser:
FindUser();
break;
caseEUsersList:
UserList();
break;
caseEDeleteUser:
DeleteUser();
break;
caseEExit:
return;
caseENone:InputError();
break;
}
}
C++搜索关键字:
可以通过string::find方法查找关键字:原型:size_t find (const string& str, size_t pos = 0) const;2、示例:string s = "c++面向对象程序设计教程";if(s.find("面向对象")!= string::npos){cout >a;if(cin.fail())//如果输入错误{cin.clear();//消除错误,这样cin才能重新输入数据你的处理。。。。}
----------------------------------------------------------------------------------------------
给SendBuf赋值为My is Server! SendBuf为char SendBuf[1024]
charSendBuf[1024];
strcpy_s(SendBuf, "Myis Server!");
|
|