视觉C(在Xcode中)>>>虽然我导入了文本文件,但它只打印0 0 0 0 0 0 0 0 0 [英] visual C(in Xcode) >>> although I imported text file, it only prints 0 0 0 0 0 0 0 0 0

查看:93
本文介绍了视觉C(在Xcode中)>>>虽然我导入了文本文件,但它只打印0 0 0 0 0 0 0 0 0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




#include <stdio.h>
#include<stdlib.h>
#include<cstring>

#define N 7

int A [N] [N];
int B [N] [N];
int C [N] [N];

FILE *fp;

int main(){
    
    int i, j;
    fp = fopen("numbers.txt", "r");  
    if(!fp){ 
        printf("fail\n");
        return 1; 
    }
    
    for(i = 0; i < N; i++){ 
        for(j = 0; j < N; j++){
            fscanf(fp, "%d", &A[i][j]); 
            printf("%2d",A[i][j]);
        }
        
    }
    
    fclose(fp); 
    
    
    return 0; 
} 

visual C(在Xcode中)>>>虽然我导入了文本文件,但它只打印0 0 0 0 0 0 0 0 0

visual C(in Xcode) >>> although I imported text file, it only prints 0 0 0 0 0 0 0 0 0

有趣的是,当我删除文本文件时,

Funny thing is, when I delete the text file,

它还打印0 0 0 0 0 0 0 0

it also prints 0 0 0 0 0 0 0 0

发生了什么事情?!

这是用Xcode编写的方式

by the way this was written in Xcode

推荐答案

这是Visio的论坛,而不是Visual Studio。

this is the forum for Visio, not for Visual Studio.

MSDN论坛上提供了Visual Studio论坛:
http://social.msdn.microsoft.com/Forums/en-US/categories

Visual Studio forums are available at the MSDN forums: http://social.msdn.microsoft.com/Forums/en-US/categories

谢谢!


这篇关于视觉C(在Xcode中)&gt;&gt;&gt;虽然我导入了文本文件,但它只打印0 0 0 0 0 0 0 0 0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆