spreadsheetcelltest.cpp
来自「C++高级编程这本书所附的源代码」· C++ 代码 · 共 28 行
CPP
28 行
#include "SpreadsheetCell.h"#include <iostream>using namespace std;int main(int argc, char** argv){ SpreadsheetCell myCell(5), anotherCell(4); cout << "cell 1: " << myCell.getValue() << endl; cout << "cell 2: " << anotherCell.getValue() << endl; SpreadsheetCell* myCellp = new SpreadsheetCell(5); SpreadsheetCell* anotherCellp; anotherCellp = new SpreadsheetCell(4); delete anotherCellp; SpreadsheetCell aThirdCell("test"); // uses string-arg ctor SpreadsheetCell aFourthCell(4.4); // uses double-arg ctor SpreadsheetCell* aThirdCellp = new SpreadsheetCell("4.4"); // string-arg ctor cout << "aThirdCell: " << aThirdCell.getValue() << endl; cout << "aFourthCell: " << aFourthCell.getValue() << endl; cout << "aThirdCellp: " << aThirdCellp->getValue() << endl; delete aThirdCellp; return (0);}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?