C++ book

Introduction to Algorithms by Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest, Clifford Stein

Bundle of Algorithms in C++, Parts 1-5: Fundamentals, Data Structures, Sorting, Searching, and Graph Algorithms (3rd Edition) (Pts. 1-5)

Clean Code: A Handbook of Agile Software Craftsmanship, by Robert C. Martin

Programming Language Pragmatics, Third Edition, by Michael L. Scott

The C++ Standard Library: A Tutorial and Reference, by Nicolai M. Josuttis

Accelerated C++: Practical Programming by Example, by Andrew Koenig, Barbara E. Moo

C++ Primer (4th Edition) by Stanley B. Lippman, Josee Lajoie, Barbara E. Moo

Programming: Principles and Practice Using C++ by Bjarne Stroustrup

Code Complete: A Practical Handbook of Software Construction, Second Edition by Steve McConnell

Exceptional C++ Style: 40 New Engineering Puzzles, Programming Problems, and Solutions by Her

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
您好!要在C++中读写Excel文件,可以使用一些第三方库,比如使用libxl或者使用Qt的QAxObject。具体步骤如下: 1. 安装libxl或者Qt 2. 引用头文件 对于libxl,需要引用xl.h头文件 ```c++ #include "libxl.h" using namespace libxl; ``` 对于Qt,需要引用QAxObject头文件 ```c++ #include <QAxObject> ``` 3. 打开Excel文件 对于libxl,使用Book类的load方法打开Excel文件 ```c++ Book* book = xlCreateBook(); // 创建一个Book对象 if (book->load("example.xls")) { // 打开Excel文件 // 打开成功 } else { // 打开失败 } ``` 对于Qt,使用QAxObject类打开Excel文件 ```c++ QAxObject* excel = new QAxObject("Excel.Application"); QAxObject* workbooks = excel->querySubObject("Workbooks"); QAxObject* workbook = workbooks->querySubObject("Open(const QString&)", "example.xls"); ``` 4. 读取或者写入数据 对于libxl,可以使用Sheet类的read和write方法来读取和写入数据 ```c++ Sheet* sheet = book->getSheet(0); // 获取第一个工作表 int value = sheet->readNum(1, 1); // 读取A2单元格的值 sheet->writeNum(2, 1, 100); // 写入B3单元格的值 ``` 对于Qt,可以使用QAxObject类的dynamicCall方法来读取和写入数据 ```c++ QAxObject* sheets = workbook->querySubObject("Worksheets"); QAxObject* sheet = sheets->querySubObject("Item(int)", 1); // 获取第一个工作表 QAxObject* cell = sheet->querySubObject("Cells(int, int)", 2, 1); // 获取A2单元格 int value = cell->dynamicCall("Value()").toInt(); // 读取单元格的值 cell->setProperty("Value", 100); // 写入单元格的值 ``` 5. 关闭Excel文件 对于libxl,使用Book类的release方法关闭Excel文件 ```c++ book->release(); // 关闭Excel文件 ``` 对于Qt,使用QAxObject类的dynamicCall方法关闭Excel文件 ```c++ workbook->dynamicCall("Close()"); excel->dynamicCall("Quit()"); ```

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值