📄 ston.cpp
字号:
// stone.cpp -- user-defined conversions
// compile with stonewt.cpp
#include <iostream>
using std::cout;
using std::endl;
#include "stonewt.h"
int main()
{
Stonewt pavarotti = 260; // uses constructor to initialize
Stonewt wolfe (285.7); // same as Stonewt wolfe = 285.7
Stonewt taft (21, 21); // NOTE: 21 stones and 21 pounds
Stonewt wolfe_and_taft;
cout<<"The tenor weighed "
"pounds mode: "; // pounds mode
cout<<pavarotti;
cout<<"The tenor weighed " // stone mode
"stone mode: ";
pavarotti.stn_mode();
cout<<pavarotti<<endl;
cout<<"The detective weighde "
"stone mode: ";
wolfe.stn_mode(); // change to stone mode
cout<<wolfe;
cout<<"The detective weighde " // change to pounds mode
"stone mode: ";
wolfe.pds_mode();
cout<<wolfe<<endl;
cout<<"The President weighde ";
cout<<taft;
taft.stn_mode();
cout<<"The President weighde ";
cout<<taft<<endl;
wolfe_and_taft = wolfe + taft; // +
cout<<"wolfe 和 taft的体重一共为: ";
cout<<wolfe_and_taft;
wolfe_and_taft.stn_mode();
cout<<"wolfe 和 taft的体重一共为: ";
cout<<wolfe_and_taft<<endl;
wolfe_and_taft = taft - wolfe; // -
cout<<"taft 比 wolfe的体重重: ";
cout<<wolfe_and_taft;
wolfe_and_taft.stn_mode();
cout<<"taft 比 wolfe的体重重: ";
cout<<wolfe_and_taft<<endl;
wolfe_and_taft = wolfe * taft;
cout<<"wolfe的体重 乘以 taft的体重为: ";
cout<<wolfe_and_taft<<endl;
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -