Skip to main content
GameDev.net gamedev.net
🔒 Locked

STRUGGLING

Started by oceangirl2012 Sep 10, 2005 at 1:04 AM 4 replies 1.2k views
Original Post
oceangirl2012
oceangirl2012
Hi all, I am new at C++ and have to complete an assignment for uni. It requires me to make a C++ program which converts polar co-ordinates to cartesian co-ordinates. If you have any advice or solutions please let me know it would be much appreciated. Cheers Trent Rhodes
_goat
_goat
HOMEWORK. I assume you know how to convert them mathematically. In that case, I suggest you Google math routines in C++. Here's a tip: sin and cos do exist, and work as expected. Also, if it's just the basics of C++ you're having trouble with, google for tutorials in that too. There's plenty out there, have fun.
Drew_Benton
Drew_Benton
As with the above posters, never underestimate the power of [Google]. To find what you are looking for do the following:

1. Open up google and query "converts polar coordinates to cartesian coordinates"   - There will be a page that tells mathmatically how to do it.2. Now open a new window and do a google query for "text input with C++"   - Unlike the last result, you will need to scan down the list some towards the bottom3. Now that you know how to get input and show output, and you know the math behind it, you just need to find the C++ math statements. Do a google seach for "C++ sin cos"   - As a general rule, look for MSDN pages when looking for functions first. It shows an example and what header file to include.


Now that you've done all of that, it's just a matter of completing the assigment. You'll want to simply ask the user for input, process that input, then show the output. That general process is one that you will always be using with C++, Input->Process->Ouput. Good luck!

P.S. If you have a computer science book with your class, look in the index for sin/cos and cin/cout.
Anri
Anri
the sin() cos() functions are okay an'all, but do take into account the conversion of radions-to-angles and vice-versa.
Languages; C, Java.        Platforms:  Android,  Oculus Go,  ZX Spectrum,  Megadrive.       Website: Mega-Gen Garage  
Mercury
Mercury
Wiki knows all. There's a section in there called "Conversion between coordinate systems".

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.