Code:
// Azhar Sheraze
// 2nd 6 weeks program
#include <iostream>
#include <iomanip>
#include <cstring>
#include <fstream>
#include <conio>
// This is my struct. This is my user defined data type, consisting of strings
// and float data types
struct team
{
string name[2], // name of player
position, // Position of player on basketball team
school, // School that Player graduated from
height; // Height of player
float score_avg, // Average Points player makes per game
rebound_avg, // Rebound average player makes per game
grade_avg, // Player's GPA
seasons_left; // Seasons left for player to play
};
void main()
{
team player[8]; // data type, Number of players
ifstream to_screen; // inputs from file to dos
char temp; // This stores the value of a blank line, so i can obtain next players
// information
int count;
to_screen.open("basketball.txt"); // This opens the text file "basketball.txt" so i
// input info into my program
for(int a=0; a<8; a++)
{
to_screen >> player[a].name[0];
to_screen >> player[a].name[1];
// cout << player[a].name << " ";
getline(to_screen, player[a].position);
// cout << player[a].position << " ";
getline(to_screen, player[a].school);
// cout << player[a].school << " ";
getline(to_screen, player[a].height);
// cout << player[a].height << " ";
to_screen >> player[a].score_avg;
// cout << player[a].score_avg << " ";
to_screen >> player[a].rebound_avg;
// cout << player[a].rebound_avg << " ";
to_screen >> player[a].grade_avg;
// cout << player[a].grade_avg << " ";
to_screen >> player[a].seasons_left;
// cout << player[a].seasons_left << " " << endl << endl;
}
// Output
// Alpha List of Names by First .... just trying stuff
temp = 'A';
count=0;
do
{
low = player[a].name[0][0];
for(int a=0; a<8; a++)
{
if(temp= player[a].name[0][0];
{
if(player[a].name[0][0] ==
}
temp++;
a=0;
}
}while(count!=8);
}