fortune1.cpp
来自「VC++串口通信设。本书详细说明讲解了在VC++环境下编写串口通信得过程。值得一」· C++ 代码 · 共 38 行
CPP
38 行
// Get needed include files
#include "Fortune1.h"
#include "Utility.h"
// Our list of fortunes
static string g_astrFortunes[] =
{
"You are strong in body and spirit.",
"You are strong in perspiration and odor.",
"Good fortune smiles upon the distributed.",
"VB Programmer for Hire -- Cheap!!",
"I never met an object I didn't like.",
"Edit, Compile, Link, Crash, Sigh.",
"Never judge a stack dump by its arguments.",
"Card carrying member of the Bug Police.",
"You make Dilbert look charming and sophisticated.",
"BMW, The Ultimate Driving Machine."
};
// Constant that tracks the number of fortunes we know about
static const ULONG g_ulNumFortunes =
sizeof(g_astrFortunes) / sizeof(string);
// Constructor
CFortuneTeller::CFortuneTeller()
{
// Seed the random number generator
SeedRandomGenerator();
}
// Lone public method
string CFortuneTeller::GetFortune()
{
return g_astrFortunes[rand() % g_ulNumFortunes];
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?