源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

C读txt到二维数组的实现方法

  • 时间:2022-04-14 02:58 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:C读txt到二维数组的实现方法
[b]实例如下:[/b]
#include<stdio.h>
#include<stdlib.h>


#define maxn 200
void main()
{
 FILE *fp;
 int s[maxn][maxn];
 int i,j;
 if((fp=fopen("d:\\temp\\test.txt","r"))==NULL)
 { 
 printf(" can't open");
 exit(0);
 }


 
 for(i=0;i<maxn;i++)
 {
 for(j=0;j<maxn;j++)
 {
 fscanf(fp,"%d",&s[i][j]);
 }
 }
  
}
以上就是小编为大家带来的C读txt到二维数组的实现方法全部内容了,希望大家多多支持编程素材网~
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部