Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Help with basketball bracket program in c++ I need help before starting my code.

ID: 3761260 • Letter: H

Question

Help with basketball bracket program in c++

I need help before starting my code.

I am reading in .txt files to a master file through an update file. My update file is supposed to be able to insert, update, and delete.

I have a master file that looks like this:

Update file has a header, detail, and trailer record. the files I read into it, look like this

The first line is the record type. The 'H', The 'D', and The 'T'

The second line the is the Add, change, or delete command.

My question is how do I go about coding the statemtents to add, change or delete.

This is the only way we have learned how to read in and the only way covered in the book

#include
#include
#include
using namespace std;
struct basketball {
   string name;
    int year;
};

im gonna skip some stuff here since i haven't coded it yet

int num=0;
ifstream inFile;
inFile.open("parts.txt", ios::in);

if (inFile.is_open()){
   while (num <= 100 && !inFile.eof()) {

       getline(inFile, basket[num].name, ',');
       inFile >> basket[num].year;
       inFile.ignore(1,',');
       num++;
   }

this just reads in files to an array. It doesn't delete, insert, or update. This logic will only append or erase and read in whatvever you send into it. I know I need a master array to store but, how do I go about making changes to it?

The update file looks like this below. with a header, detail, and trailer at the end.

The master will look like this:

Explanation / Answer

#include <stdio.h>

/* Iterative function to reverse digits of num*/

int reversDigits(int num)

{

    int rev_num = 0;

    while(num > 0)

    {

        rev_num = rev_num*10 + num%10;

        num = num/10;

    }

    return rev_num;

}

/*Driver program to test reversDigits*/

int main()

{

    int num = 4562;

    printf("Reverse of no. is %d", reversDigits(num));

    getchar();

    return 0;

}

#include <stdio.h>

/* Iterative function to reverse digits of num*/

int reversDigits(int num)

{

    int rev_num = 0;

    while(num > 0)

    {

        rev_num = rev_num*10 + num%10;

        num = num/10;

    }

    return rev_num;

}

/*Driver program to test reversDigits*/

int main()

{

    int num = 4562;

    printf("Reverse of no. is %d", reversDigits(num));

    getchar();

    return 0;

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote