📄 mailsystem.cpp.html
字号:
<html>
<head>
<title>mailsystem.cpp</title>
</head>
<body>
<pre> 1 #include <sstream>
2 #include "mailbox.h"
3 #include "mailsystem.h"
4
5 using namespace std;
6
7 MailSystem::MailSystem(int mailbox_count)
8 {
9 for (int i = 0; i < mailbox_count; i++)
10 {
11 ostringstream passcode;
12 passcode << i;
13 ostringstream greeting;
14 greeting << "You have reached mailbox " << i
15 << ". \nPlease leave a message now.";
16 mailboxes.push_back(new Mailbox(passcode.str(), greeting.str()));
17 }
18 }
19
20 int string_to_int(string s)
21 {
22 istringstream instr(s);
23 int n;
24 instr >> n;
25 return n;
26 }
27
28 Mailbox* MailSystem::find_mailbox(string ext) const
29 {
30 int i = string_to_int(ext);
31 if (1 <= i && i <= mailboxes.size())
32 return mailboxes[i];
33 return NULL;
34 }</pre>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -