Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using C++ read the file 3460-hpgl-2018.txt and find the x,y coordinates after each PA and convert them to real numbers using the double declaration. Output

Using C++ read the file "3460-hpgl-2018.txt" and find the x,y coordinates after each PA and convert them to real numbers using the "double" declaration. Output the data as lines in .dxf (autocad) format. The first point in the .txt file is the start point of each (2) lines.

3460-hpgl-2018.txt file:

IN;SC;PU;PU;SP7;LT;VS36;PU;PA19485,12150;PD;AP;PA15883,11118;PA16292,14387;PA18000,12000;PA19485,12150;SP;EAC;PG1;EC1;OAE;

Alter the program below which finds each x and y coordinate and prints them out in a .txt file. The coordinates do not need to be printed out, just use the coordinates found to create the lines in the .dxf file.

#include "stdafx.h"

#include

#include

using namespace std;

int _tmain(int argc, _TCHAR* argv[])

{

char check;

double x, y;

ifstream input("3460-hpgl-2018.txt");

ofstream out("lab4.txt");

while (!input.eof())

{

input >> check;

if (check == 'P')

{

input >> check;

if (check == 'A')

{

input >> x;

input >> check;

if (check == ',')

{

input >> y;

cout << "x = " << x << ", y = " << y << endl;

out << x << y << endl;

}

}

}

}

return 0;

}

Hint, The text below has to be used in the new program with x and y values replaced where x and y written for it to work correctly:

0

SECTION

2

ENTITIES

0

LINE

8

0

10

x or y

20

x or y

30

x or y

11

x or y

21

x or y

31

x or y

0

ENDSEC

0

EOF

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

Database Design Query Formulation And Administration Using Oracle And PostgreSQL

Authors: Michael Mannino

8th Edition

1948426951, 978-1948426954

Students also viewed these Databases questions

Question

Understanding Groups

Answered: 1 week ago