how to read from txt file to array & how to omit heading in the txt file and store it to array

how to read from txt file to array & how to omit heading in the txt file and store it to array

There's a couple of articles to get you started. Once you actually have some code you need help with let us know.

**To store the details in the txt file i have attached i wrote this coding in it how can i store the information separetly for round 1, round 2.... **

void getDetail(p_info gamers[ ])        //Function to input competitor details
{
    string arr[player];
    ifstream file;
    file.open("pp.txt");

    if(!file.is_open())
    {
        cerr<<"Cannot open the file"<<endl;
    }
    else
    {

            string line;
        for (int i= 0; i<player; i++)
        {
            getline(file,arr[i]);
            stringstream val;
            val << arr[i];

            getline(val, line, ';');
            gamers[i].num = atoi(line.c_str());

            getline(val, line, ';');
            gamers[i].name = line;

            getline(val, line, ';');
            gamers[i].age = atoi(line.c_str());

            getline(val, line, ';');
            gamers[i].coins = atoi(line.c_str());

            getline(val, line, ';');
            gamers[i].score = atoi(line.c_str());

            getline(val, line, ';');
            gamers[i].distance = atoi(line.c_str());
        }
        file.close();

how can i store the information separetly for round 1, round 2....

You could just add a line at the start with the "Round " and the round number, before you write any other information.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.