how can I get my program to read one of 4 text files (chosen/ inputted by...

50.1K

Verified Solution

Question

Programming

how can I get my program to read one of 4 text files (chosen/inputted by user, game1.txt, game2, game3, or game4.txt). and placeits information into variables, one of which is an array. I sort ofunderstand this, but I don't know how to make my program know whichparts of the textfile go into which variables.

my 4 textfiles are in the format: the list of e4-bc needto be entered into my array.

B35e4 e5 Bc4 Nc6 Nf3 Bc5 c3 Nf6h3 Nxe4 d4 d5 Bb3 exd4 Nbd2 Nxf2e2+ Qe7 Qxe7+ Nxe7 Kxf2 dxc3+ Kf1 Nf5bxc3 Ng3+ Ke1 Nxh1 Bxd5 O-O g4 Nf2Rb1 c6 Bc

my variables that those need to be inputted into are inthis abstract data type class:

class Game

{

public:

char outcome; //(whether black or white teamwon)

int numMoves;

string arrayMoves;}

Answer & Explanation Solved by verified expert
4.0 Ratings (789 Votes)
Given below is the code for the question Please do rate theanswer if    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students