Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

/* 1. Read in the robosim.txt file Examples of reading files a line at a time are in session03 Create class call robot, include name

/* 1. Read in the robosim.txt file Examples of reading files a line at a time are in session03 Create class call robot, include name and location of the robot x,y create vector called robots, contains robot in each elements. create vector called beacons, contains beacon in each element for each line in the file beginning with "beacon", add a new beacon object to a list of beacons vector. for each line in the file beginning with "robot", add a new robot object to a list of robots vector. After the file is completely read first: 1) print a list of all the beacons (with name, x, y) 2) print a list of all the robots (with name, x, y) */ #include #include #include #include #include using namespace std; class robot{ private: string name; double x,y; public: //create constructors //create operator overloading for << prototype }; //implementation of the operator overloading << int main() { ifstream f; char buffer [4096]; f.open("robosim.txt"); if (f.fail()){ cerr << "error opening the file" << endl; } string x; //while (f.getline(buffer,sizeof(buffer))) { //

// if (a == "beacon"){ // if (a == "robot"){ f.close(); }

==================================================================================================================

beacon b1 5 1 beacon b2 -3 3 beacon b3 -1 4 robot r1 1 2 robot r2 10 5

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

Filing And Computer Database Projects

Authors: Jeffrey Stewart

2nd Edition

007822781X, 9780078227813

More Books

Students also viewed these Databases questions