I have a program I am writing and it goes through a text file that has a name and then a number over an over again. I'm just trying to get the output to display the highest number and the name associated with it.
Example of the file:
Chris
40.32
32.33
David
22.24
55.76
Bob
79.35
44.32
Now my program goes through that and it can successfully compare the numbers but I cant get the names to come out because they are characters and I dont know how to do that part correctly.
I'm not familiair with reading files, but when i try to compile your code it gives an error in line 25: ISO C++ forbids assignment of arrays. I suggest you try type string for Name and HighName instead of char[].
A couple of things, like scipio said, you shouldn't use c style char name[20], instead use c++ strings, you can copy one to another directly.
you have to add
#include <string>
to your other includes, then initialize name
string Name=""; //make sure you use double quotes
string HighName="";