使用C++实现对Excel文件的写入操作

先推荐一波大佬的博客吧~:https://blog.csdn.net/fullsail/article/details/8449448

然后再自己实践一下。

1.首先出现的问题是:#include"StdAfx.h"头文件没有定义;

这个问题虽然重要,但是可以放在最后解决。

2.感觉添加库实在是太繁琐了,推荐一种简单的解决方法:

https://blog.csdn.net/u010325168/article/details/53005159

还有这一篇:https://blog.csdn.net/zhongjling/article/details/49818151

使用标准输入进行成绩输入,使用fstream类进行Excel表的填写。

我们的C++作业,代码如下所示:需要注意的是:

1.可以不创建.csv文件。程序运行后系统自动创建。

2.将cpp文件放在桌面上,在桌面上运行效果更明显。

3.更换单元格用逗号分隔符,文件类型一定要用.csv文件

//#include"stdafx.h"
#include 
#include
#include
#include
//以下是文件读入输出需要的头文件
#include
#include
#include
#include 
using namespace std;
const int maxn=30;
int i,j;
struct node
{
    long number;
    char name[4];
    int score[5];
    int sum;
} pp[maxn];
bool cmp(node a,node b)
{
    if(a.sum>b.sum)
        return true;
    else if(a.sum==b.sum&&a.number

关于文件的输入:txt输入需要再进行学习。

你可能感兴趣的:(C++学习+字符串处理)