| delorie.com/archives/browse.cgi | search |
| Date: | Sat, 3 Mar 2001 19:27:02 -0500 |
| Message-Id: | <200103040027.TAA09839@envy.delorie.com> |
| X-Authentication-Warning: | envy.delorie.com: dj set sender to dj AT envy DOT delorie DOT com using -f |
| From: | DJ Delorie <dj AT delorie DOT com> |
| To: | djgpp AT delorie DOT com |
| In-reply-to: | <Fqeo6.142$nj5.49880@sapphire.mtt.net> |
| (jstewart1 AT ns DOT sympatico DOT ca) | |
| Subject: | Re: trig function?? loopings |
| References: | <Fqeo6.142$nj5 DOT 49880 AT sapphire DOT mtt DOT net> |
| Reply-To: | djgpp AT delorie DOT com |
| Errors-To: | nobody AT delorie DOT com |
| X-Mailing-List: | djgpp AT delorie DOT com |
| X-Unsubscribes-To: | listserv AT delorie DOT com |
What I would do (besides not using C++ for such a trivial task ;) is read in a line (array of chars), check the line for being empty (the sentinel), and then parse the line as a number (using sscanf, I suppose). That also handles bogus input better, since your code won't handle malformed input well. In general, when I want a line of input from the user, I read a *line*, and parse it myself. You should also multiply degrees times M_PI/180, not the other way around.
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |