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

Plz, use C++ code Use the file polar.dat in Blackboard section Code- > Ch6-10- >

ID: 3858200 • Letter: P

Question

Plz, use C++ code

Use the file polar.dat in Blackboard section Code- > Ch6-10- > Ch8 for this work. The file polar.dat contains polar coordinates as distance and angle pairs, one per line Create a C++ program that reads this file and creates a second file named xycord dat. The entries in the new file should contain the rectangular coordinates corresponding to the polar coordinates in the polar.dat file. Polar coordinates are converted to rectangular coordinates using these formulas: x = r cos a y = r cos a r is the distance coordinate, a is the radian equivalent of the angle coordinate Format the contents of xycord dat so that numbers are properly aligned Submit the files polar.dat, xycord.dat and the cpp file in a compressed file. The cpp file should contain a comment at the top with your name course code and date. ex.//Miguel Long MAC102 July 15. 2017

Explanation / Answer

#include<bits/stdc++.h>

using namespace std;

#define pi 3.14

int main()

{

ifstream myfile;

myfile.open("data.txt");

ofstream fout;

fout.open("notes.txt");

int a,r;

while (myfile.eof())

{

myfile>>a>>r;

cout<<a<<" "<<r<<endl;

float deg=(pi/180)*a;

float x=r*cos(deg);

float y=r*sin(deg);

fout<<x<<" "<<y<<endl;

}

}

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