胖鸭 2018-11-05 03:13
浏览 646

如何使用 c [保持]读取文本文件中的浮点数

The text file contains the text below, how to write a program to save it to a variable called 'a'?

Bank    Rate(1) Rate(2) Rate(3)
A   1.11    1.52    1.26
B   3.22    4.24    5.25
C   1.68    7.68    7.2
D   3.26    4.23    1.7

转载于:https://stackoverflow.com/questions/53147840/how-can-i-read-a-float-numbers-which-are-in-a-text-file-using-c

  • 写回答

1条回答 默认 最新

  • 乱世@小熊 2018-11-05 03:57
    关注

    Open the file, read each line, and then scan for the floats. You can accomplish this quite easily. There are about a dozen similar questions dedicated directly to reading float numbers from files using C posted here.

    Here are some similar questions on StackOverflow which you can use to help accomplish your task:

    Read int OR float from file in C

    How to read floats from file in c?

    C - Read in float value using getchar and print out float using printf

    Reading float using scanf in c

    评论

报告相同问题?

悬赏问题

  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!