Re: Circle Calculator Help

2012-06-26 Thread Timon Gehr
On 06/27/2012 01:40 AM, Steven Schveighoffer wrote: On Tue, 26 Jun 2012 19:10:25 -0400, bearophile wrote: Steven Schveighoffer: I agree with Andrei, there is no outlet for errors in the to!T function, exception is the logical choice. Maybe I was not clear enough, so let me explain a bit be

Re: Circle Calculator Help

2012-06-26 Thread Steven Schveighoffer
On Tue, 26 Jun 2012 19:44:34 -0400, Sean Kelly wrote: On Jun 26, 2012, at 4:40 PM, Steven Schveighoffer wrote: On Tue, 26 Jun 2012 19:10:25 -0400, bearophile wrote: Steven Schveighoffer: I agree with Andrei, there is no outlet for errors in the to!T function, exception is the logica

Re: Circle Calculator Help

2012-06-26 Thread Sean Kelly
On Jun 26, 2012, at 4:40 PM, Steven Schveighoffer wrote: > On Tue, 26 Jun 2012 19:10:25 -0400, bearophile > wrote: > >> Steven Schveighoffer: >> >>> I agree with Andrei, there is no outlet for errors in the to!T function, >>> exception is the logical choice. >> >> Maybe I was not clear enoug

Re: Circle Calculator Help

2012-06-26 Thread Steven Schveighoffer
On Tue, 26 Jun 2012 19:10:25 -0400, bearophile wrote: Steven Schveighoffer: I agree with Andrei, there is no outlet for errors in the to!T function, exception is the logical choice. Maybe I was not clear enough, so let me explain a bit better. What I don't like is to!int("15\n") to be s

Re: Circle Calculator Help

2012-06-26 Thread bearophile
Steven Schveighoffer: I agree with Andrei, there is no outlet for errors in the to!T function, exception is the logical choice. Maybe I was not clear enough, so let me explain a bit better. What I don't like is to!int("15\n") to be seen as an error in the first place. I'd like it to ignore l

Re: Circle Calculator Help

2012-06-26 Thread Alexander
That must be why, I didn't import std.string! Thanks!

Re: Circle Calculator Help

2012-06-26 Thread Steven Schveighoffer
On Tue, 26 Jun 2012 17:17:29 -0400, bearophile wrote: Steven Schveighoffer: Oh, readln includes the newline by default, so to!float is choking on that. Similar things happen often. But Andrei says this is good, because it's more orthogonal. As Sting, I don't subscribe to this point of

Re: Circle Calculator Help

2012-06-26 Thread bearophile
Steven Schveighoffer: Oh, readln includes the newline by default, so to!float is choking on that. Similar things happen often. But Andrei says this is good, because it's more orthogonal. As Sting, I don't subscribe to this point of view. Orthogonality isn't more important than practicality.

Re: Circle Calculator Help

2012-06-26 Thread Steven Schveighoffer
On Tue, 26 Jun 2012 16:39:07 -0400, Alexander wrote: So, I've taken out the loop part that is "interesting" and replaced it with the readln() alternative. However, I'm still getting what looks like an error. I managed to take a screenshot of what pops up, and here is what it says: std.conv

Re: Circle Calculator Help

2012-06-26 Thread Alexander
I'll probably put in this alternative: void wait() { char[] a; while(a != "A") { writeln("Type A to continue!"); stdin.readln(a); } Thanks!

Re: Circle Calculator Help

2012-06-26 Thread Alexander
So, I've taken out the loop part that is "interesting" and replaced it with the readln() alternative. However, I'm still getting what looks like an error. I managed to take a screenshot of what pops up, and here is what it says: std.conv.ConvException@C:\D\dmd2\windows\bin\..\..\src\phobos\std

Re: Circle Calculator Help

2012-06-26 Thread Timon Gehr
On 06/26/2012 09:43 PM, Steven Schveighoffer wrote: On Tue, 26 Jun 2012 10:40:18 -0400, Alexander wrote: ... //Wait void wait() { writefln ("Type A to continue!"); exittest(); } //Exit tester void exittest() { char[] a; stdin.readln(a); if (a == "A") { exit();

Re: Circle Calculator Help

2012-06-26 Thread Steven Schveighoffer
On Tue, 26 Jun 2012 10:40:18 -0400, Alexander wrote: Hello everybody! I am new to D, and I am working on a program that calculates the area and circumference of a circle. However, when I compile it and run it, it waits for the user to input the radius, but then it closes while displayi

Re: Circle Calculator Help

2012-06-26 Thread Alexander
On Tuesday, 26 June 2012 at 14:53:33 UTC, Adam D. Ruppe wrote: You should be able to just do a readln() before exiting to give the user a chance to read everything, and hit enter to exit. I just tried that, and it still closed right after I typed the radius. It looks almost like error code tha

Re: Circle Calculator Help

2012-06-26 Thread Adam D. Ruppe
You should be able to just do a readln() before exiting to give the user a chance to read everything, and hit enter to exit.

Re: Circle Calculator Help

2012-06-26 Thread Alexander
By the way, this is just my 2nd program in D. It is just for fun, and I'm doing it to practice using this language. This is normally how I teach myself languages. I write a simple one then a more complex one on and on until I'm fluent in the language. I don't have the book (but I'll get it soo

Circle Calculator Help

2012-06-26 Thread Alexander
Hello everybody! I am new to D, and I am working on a program that calculates the area and circumference of a circle. However, when I compile it and run it, it waits for the user to input the radius, but then it closes while displaying a bunch of stuff. I've tried several ways to get it to wa