Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need to read from a delimited txt file of the following format: Name, num1,num2,num3,num4. ex: John, 4,5,6,3 Jane,6,4,7,4 etc. I have a pointer to

I need to read from a delimited txt file of the following format:

Name, num1,num2,num3,num4. ex: John, 4,5,6,3 Jane,6,4,7,4 etc. I have a pointer to a dynamic array of pointers to persons(characters).

PersonCatalogue.cpp

PersonCatalogue::PersonCatalogue(std:: string personFile){ std::ifstream File1;

File1.open(personFile);

if(!File1){ std::cour << "Can't open the file"; exit(1); }

std::string character, num1,num2,num3,num4; int number1, number2, number3, number4; while (!File1.eof()){ std::getline(File1, person, ','); std::getline(File1, num1, ','); std::getline(File1, num2, ','); std::getline(File1, num3, ','); std::getline(File1, num4, ',');

number1=std::stoi(num1); number2=std::stoi(num2); number3=std::stoi(num3); number4=std::stoi(num4); } }

I also have person class which gets the name and the numbers from each person.

I don't really know what to do next and how to assign the values to the pointer or to an array. Any help would be great. Thanks.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle RMAN For Absolute Beginners

Authors: Darl Kuhn

1st Edition

1484207637, 9781484207635

More Books

Students also viewed these Databases questions