In this video, see a solution to this chapter's challenge.
(upbeat music)…- [Instructor] My solution to this challenge…is very straight forward.…So, the first thing I want to show you is in line 4.…Where I defined a symbol for pi.…And this shouldn't be really necessary if I am…using a math library, right?…Well, it turns out that constants like pi,…are not portable in the C standard library distributions.…So, some distributions may have it and some may not…because this is implementation defined.…
And so I had to define my own.…And this will be useful to convert degrees to radiance…and the other way around.…Because as you may remember, the trigonometric functions…use angles in radiance.…So at the beginning of the main function in line 7,…I'm defining some variables which are all double…floating point numbers.…And they are A_x, A_y,…B_radius, and B_angle because I am defining two points.…
One that is called A and one that is called B.…A will be represented in Cartesian coordinates…and I will convert it to Polar.…And B will come in Polar coordinates…and I will convert it to Cartesian coordinates.…
Author
Released
2/6/2019- Working with header files
- C constants and types
- Unformatted and formatted input/output
- Accessing files with C functions
- Generating random numbers
- Converting strings
- Sorting and searching for data
- Manipulating strings
- Using mathematical functions
Skill Level Intermediate
Duration
Views
Related Courses
-
Learning C (2014)
with Dan Gookin3h 28m Beginner -
C Essential Training
with Isac Artzi7h 22m Beginner -
Advanced C Programming
with Dan Gookin1h 23m Intermediate -
C++ Standard Template Library
with Eduardo Corpeño2h 23m Advanced
-
Introduction
-
1. The C Standard Library
-
Overview of the library1m 51s
-
Header files1m 50s
-
Constants and types3m 47s
-
-
2. Input and Output Library: stdio.h
-
Unformatted I/O2m 34s
-
Unformatted I/O example2m 34s
-
Formatted I/O2m 51s
-
Formatted I/O example5m 10s
-
File access1m 55s
-
File access example3m 53s
-
-
3. General Purpose: stdlib.h
-
Memory allocation1m 32s
-
Memory allocation example2m 29s
-
Random number generation1m 48s
-
String conversion2m 11s
-
String conversion example6m 29s
-
Sort and search1m 52s
-
Sort and search main4m 50s
-
Challenge: Let's get random1m 38s
-
Solution: Let's get random5m 40s
-
-
4. String Functions: string.h
-
String manipulation1m 21s
-
String examination1m 43s
-
-
5. Mathematical Functions: math.h
-
Mathematical functions2m 50s
-
Trigonometric functions1m 42s
-
Powers and exponentials1m 9s
-
-
Conclusion
-
Next steps1m
-
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.
CancelTake notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.
Share this video
Embed this video
Video: Solution: Polar coordinate conversion