![]() |
| | #1 |
| Registered User Join Date: Jul 2009
Posts: 8
| Newbie problem int radius = 4; decimal circumfere; int diameter; diameter = 2 * radius; circumfere = PI * diameter; Console.WriteLine("The circumference is : ", circumfere); Its a program to calculate the circumference of a circle on c# Console application, it only displays "The circumference is : " and nothing else.. can one of you help me? |
| -Od|n- is offline | |
| | #2 |
| Confused Join Date: Sep 2001 Location: Sweden
Posts: 3,125
| Code: Console.WriteLine("The circumference is : " + circumfere);
__________________ MagosX.com Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime. |
| Magos is online now | |
| | #3 |
| Registered User Join Date: Jul 2009
Posts: 8
| |
| -Od|n- is offline | |
| | #4 |
| int x = *((int *) NULL); Join Date: Jul 2003 Location: Banks of the River Styx
Posts: 902
| For more complex strings, you'll find formatting easier. (Concatentation is fine in this case) Following your initial attempt: Code: Console.WriteLine("The circumference is : {0}", circumference);
__________________ long time; /* know C? */ Unprecedented performance: Nothing ever ran this slow before. Any sufficiently advanced bug is indistinguishable from a feature. Real Programmers confuse Halloween and Christmas, because dec 25 == oct 31. The best way to accelerate an IBM is at 9.8 m/s/s. recursion (re - cur' - zhun) n. 1. (see recursion) |
| Cactus_Hugger is offline | |
| | #5 |
| Guest Join Date: Aug 2001
Posts: 5,034
| >> For more complex strings, you'll find formatting easier. (Concatentation is fine in this case) Following your initial attempt: True, but it's error prone and a pain to make changes. I would use the concatenation approach in every case, personally. |
| Sebastiani is offline | |
| | #6 | |
| int x = *((int *) NULL); Join Date: Jul 2003 Location: Banks of the River Styx
Posts: 902
| Quote:
Code: String.Format("{0} cat", color == Color.Black ? "black" : "blue")
Code: String.Format("char {0}", color == Color.Black ? "noir" ? "bleu")
__________________ long time; /* know C? */ Unprecedented performance: Nothing ever ran this slow before. Any sufficiently advanced bug is indistinguishable from a feature. Real Programmers confuse Halloween and Christmas, because dec 25 == oct 31. The best way to accelerate an IBM is at 9.8 m/s/s. recursion (re - cur' - zhun) n. 1. (see recursion) | |
| Cactus_Hugger is offline | |
| | #7 |
| Registered User Join Date: Jul 2009
Posts: 8
| k i understand the difference betwen using commas and the concatenation sign now thanx a bunch although I havn't gotten to string formatting yet ( last post)... |
| -Od|n- is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| validation problem in a loop (newbie question) | Aisthesis | C++ Programming | 11 | 05-10-2009 10:47 PM |
| Newbie problem with scanf function... | Mithal | C Programming | 1 | 11-13-2005 10:28 PM |
| Newbie ... looping problem | StupidIntel | C++ Programming | 12 | 05-13-2004 06:45 PM |
| Problem with code (newbie question) | Unregistered | C++ Programming | 5 | 07-31-2002 01:39 AM |
| newbie coding problem | rippascal | C++ Programming | 10 | 01-08-2002 11:45 PM |