spreadsheetcelltest.cpp

来自「C++高级编程这本书所附的源代码」· C++ 代码 · 共 26 行

CPP
26
字号
#include "SpreadsheetCell.h"#include <iostream>using namespace std;int main(int argc, char** argv){  SpreadsheetCell myCell(4), anotherCell(5);  SpreadsheetCell aThirdCell = myCell + anotherCell;  string str = "hello";  aThirdCell = myCell + str;  aThirdCell = myCell + 5.6;  aThirdCell = myCell + 4;  aThirdCell = myCell + 4; // works fine  aThirdCell = myCell + 5.6; // works fine  // The following two lines don't compile  //  aThirdCell = 4 + myCell; // FAILS TO COMPILE!  // aThirdCell = 5.6 + myCell; // FAILS TO COMPILE!  return (0);}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?