So, I figured I had my code working. However, when ran its not displaying the pitchers names from my file. it displays the ERA in ascending order, just not the pitchers names. Heres my code:
#include <iomanip>
#include <fstream>
#include <string.h>
using namespace std;
void SelectionSort(char pitchers[][30], int pitcherNum, float IP[], float ERA[]);
void swapPitchers(char pitchers[][30], int Min, int passNum, int pitcherNum);
int main()
{
ifstream myFile;
myFile.open("file.txt");
char pitchers[50][30];
float ERA[50];
float Innings;
int EarnedRuns;
float IP[50];
int ER[50];
int pitcherNum=0;
int v;
int k;
for (k=0; k<50; k++)
{
IP[k]=0;
ER[k]=0;
}
while (!myFile.eof()) //start outer loop
{
myFile.get(pitchers[v],30);
myFile>>ws; // extract whitespace to move to next line
This only prints out
"∞vpbè 25.67 1.75
20.34 3.10
25.51 5.64".
There should be names before the numeric values. They should be where the gibberish characters are.