第2课 建一个99乘法表
2012-12-24 16:27
946 查看
这部分演示如何把数据放入网格内。
第1步 添加网格行和列的标题
在 MyCug 类的 OnSetup() 函数中添加编辑为如下代码:
C++ Code
第2步 把乘法表置入网格中
在 MyCug 类的 OnSetup() 函数中添加编辑为如下代码:
C++ Code
编译 运行
第1步 添加网格行和列的标题
在 MyCug 类的 OnSetup() 函数中添加编辑为如下代码:
C++ Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | void MyCug::OnSetup() { //****** Declare all variables CString heading; int num_rows, num_cols, index; //****** Set the Rows and Columns SetNumberCols(10); SetNumberRows(10); //****** Get the number of rows and columns num_rows = GetNumberRows(); num_cols = GetNumberCols(); //******* Add the Row Heading to the grid for (index = 0; index < num_rows; index++) { heading.Format("%d", index + 1); QuickSetText(-1, index, heading); } //****** Add the Column Heading to the grid for (index = 0; index < num_cols; index++) { heading.Format("%d", index + 1); QuickSetText(index, -1, heading); } } |
在 MyCug 类的 OnSetup() 函数中添加编辑为如下代码:
C++ Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | void MyCug::OnSetup() { //****** Declare all variables CString heading, number; int num_rows, num_cols, index; //****** Set the Rows and Columns SetNumberCols(10); SetNumberRows(10) ; //****** Get the number of rows and columns num_rows = GetNumberRows(); num_cols = GetNumberCols(); //******* Add Row Heading to the grid for (index = 0; index < num_rows; index++) { heading.Format("%d", index + 1); QuickSetText(-1, index, heading); } //****** Add the Column Heading to the grid for (index = 0; index < num_cols; index++) { heading.Format("%d", index + 1); QuickSetText(index, -1, heading); } //***** Add the Multiplication table to the grid for (int x = 0; x < num_cols; x++) { for(int z = 0; z < num_rows; z++) { number.Format("%d", ((x + 1) * (z + 1))); QuickSetText(x, z, number); } } } |
相关文章推荐
- Python(5)使用for...in循环和列表推导式打印一个99乘法表
- 编写一个程序,输出99乘法表
- 一个for打印99乘法表
- 使用JavaScript实现一个小程序之99乘法表
- 输入一个数字,打印出对应行数的99乘法表
- 一个乘法小99的程序
- 打印99乘法口诀 一个for循环
- 一个循环 写出99乘法表
- python 一个变量打印99乘法表
- 一个打印 99乘法表的shell程序
- 一个小小99乘法表的思路
- 一个循环实现99乘法表
- java用一个for循环输出99乘法表
- 99乘法表 (输入一个数,以该数为行数输出乘法表)
- 运用for循环制作一个99乘法表
- 用二维数组保存99乘法表并且输入一个数查找它是否在数组中存在
- 使用main函数的参数,实现一个整数计算器,程序可以接受三个参数,第一个参数“-a”选项执行加法,“-s”选项执行减法,“-m”选项执行乘法,“-d”选项执行除法,后面两个参数为操作数。
- 练习: C#---函数(100以内7有关的数、99乘法表、100以内奇数和、硬币组合)
- [shell]两种方法写出99乘法表
- IOS 99乘法表