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
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