⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gridtest.cpp

📁 C++高级编程这本书所附的源代码
💻 CPP
字号:
#include "Grid.h"#include "SpreadsheetCell.h"#include <string>#include <vector>using namespace std;void processIntGrid(Grid<int>& inGrid){  // body omitted for brevity}int main(int argc, char** argv){  Grid<int> myIntGrid; // declares a grid that stores ints  myIntGrid.setElementAt(0, 0, 10);  int x = myIntGrid.getElementAt(0, 0);  Grid<int> grid2(myIntGrid);  Grid<int> anotherIntGrid = grid2;  //Grid test; // WILL NOT COMPILE  //Grid<> test; // WILL NOT COMPILE  Grid<SpreadsheetCell> mySpreadsheet;  SpreadsheetCell myCell;  mySpreadsheet.setElementAt(3, 4, myCell);  Grid<char*> myStringGrid;  myStringGrid.setElementAt(2, 2, "hello");  Grid<vector<int> > gridOfVectors; // Note the extra space!  vector<int> myVector;  gridOfVectors.setElementAt(5, 6, myVector);  //Grid<vector<int>> gridOfVectors; // INCORRECT SYNTAX  Grid<int>* myGridp = new Grid<int>();  myGridp->setElementAt(0, 0, 10);  x = myGridp->getElementAt(0, 0);  delete myGridp;  return (0);}

⌨️ 快捷键说明

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