C++文件按行读取,并存入数组

[复制链接]
查看11 | 回复2 | 2010-4-19 09:35:33 | 显示全部楼层 |阅读模式
//程序可以运行!!!#include#includeusing namespace std;#define N 100void next_line(ifstream& ins){ char symbol; do{ins.get(symbol); }while(symbol!='\n');}int main(){ intvalue[N][2],i=0,length; char symbol; ifstreamins; ins.open("a.txt"); while(!ins.eof()) {next_line(ins);ins>>value[0];ins.get(symbol);ins>>value[1];i++;
} length=i; for(i=0;i>s[j];} 这就是读取
回复

使用道具 举报

千问 | 2010-4-19 09:35:33 | 显示全部楼层
#includeusing namespace std;void main(){int s[8][2];ifstream fin("a.txt");for(int i=0;i>s[j];//提取}
回复

使用道具 举报

千问 | 2010-4-19 09:35:33 | 显示全部楼层
我吃多了
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行