From: "Brian Christiansen" Newsgroups: comp.os.msdos.djgpp References: Subject: Re: convert miles to kilometres Lines: 31 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 Message-ID: Date: Tue, 27 Feb 2001 17:40:22 GMT NNTP-Posting-Host: 63.23.230.117 X-Complaints-To: abuse AT earthlink DOT net X-Trace: newsread2.prod.itd.earthlink.net 983295622 63.23.230.117 (Tue, 27 Feb 2001 09:40:22 PST) NNTP-Posting-Date: Tue, 27 Feb 2001 09:40:22 PST Organization: EarthLink Inc. -- http://www.EarthLink.net To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com "Stewart" wrote in message news:XoBm6.206$GF DOT 50463 AT sapphire DOT mtt DOT net... > Can you help me write a C++ program that uses include which has > a function to convert miles to kilometres. Use #include - this is the newer standard and if you have the latest version of DJGPP, it certainly supports this form. >( 1 km = 0.621371 miles I think) > What const double can I use for the conversion factor? 0.621371 or its recipricol 1.6-whatever seems like a good idea to me. If you mean what name to use, any legal C++ name will do, though it is probably better to use something that is "meaningful", like maybe "miles_to_km" (the compiler itself doesn't care if you call it "fred". > In more particular terms, I need help to write a program that prompts the > user for a value in miles and outputs the equivalent value in km using a > precision of 2 digits after the decimal. To ouput other than the default number of decimal places, #include and read up on the functions provided therein. Can anyone help me? I am sure there are plenty of people who can, probably even I could, but since this sounds a whole lot like a homework assignment, attempt writing this program, post the code, and I am sure that some nice peron will help you fix it. Brian Christiansen> >