7*4 2018-11-05 03:13 采纳率: 50%
浏览 283

如何使用 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

    评论

报告相同问题?

悬赏问题

  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥15 想问一下树莓派接上显示屏后出现如图所示画面,是什么问题导致的
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败