Click here to Skip to main content
15,923,142 members
Home / Discussions / Managed C++/CLI
   

Managed C++/CLI

 
AnswerRe: Ad Hoc routing protocol Pin
Richard MacCutchan18-Apr-13 4:27
mveRichard MacCutchan18-Apr-13 4:27 
GeneralRe: Ad Hoc routing protocol Pin
3bood.ghzawi18-Apr-13 5:09
3bood.ghzawi18-Apr-13 5:09 
GeneralRe: Ad Hoc routing protocol Pin
Richard MacCutchan18-Apr-13 5:42
mveRichard MacCutchan18-Apr-13 5:42 
GeneralRe: Ad Hoc routing protocol Pin
3bood.ghzawi19-Apr-13 0:05
3bood.ghzawi19-Apr-13 0:05 
GeneralRe: Ad Hoc routing protocol Pin
Richard MacCutchan19-Apr-13 0:38
mveRichard MacCutchan19-Apr-13 0:38 
GeneralRe: Ad Hoc routing protocol Pin
Joe Woodbury24-Apr-13 8:22
professionalJoe Woodbury24-Apr-13 8:22 
GeneralRe: Ad Hoc routing protocol Pin
Richard MacCutchan24-Apr-13 9:30
mveRichard MacCutchan24-Apr-13 9:30 
QuestionDisplay only 2 digs in string in label. Pin
Søren Lyder Nielsen17-Apr-13 23:50
Søren Lyder Nielsen17-Apr-13 23:50 
Hey.


I am trying to get my program to display only 2 decimals of the result og an calculation.

Code:
C#
// Defination af input
             dansk = System::Convert::ToDouble(textBox2->Text);
             kurs = System::Convert::ToDouble(numericUpDown1->Text);

             // Udregningerne
             tysk = dansk / kurs;
             ti = tysk * 0.90;
             femten = tysk * 0.85;
             tyve = tysk * 0.82;
             bdansk = tysk * kurs * 1.25;
             bti = tysk * 0.90 * 1.25;
             bfemten = tysk * 0.85 * 1.25;
             btyve = tysk * 0.82 * 1.25;
             btysk = tysk * 1.18;

             //konvertering til udskrivning af resultat
             label7->Text = System::Convert::ToString(dansk) + " Kr";
             label8->Text = System::Convert::ToString(ti) + " Kr";
             label9->Text = System::Convert::ToString(femten) + " Kr";
             label10->Text = System::Convert::ToString(tyve) + " Kr";
             label14->Text = System::Convert::ToString(bdansk) + " Kr";
             label15->Text = System::Convert::ToString(bti) + " Kr";
             label16->Text = System::Convert::ToString(bfemten) + " Kr";
             label17->Text = System::Convert::ToString(btyve) + " Kr";
             label20->Text = System::Convert::ToString(tysk) + " Eur";
             label21->Text = System::Convert::ToString(btysk) + " Eur";


My ints are defined another place in my prpgram.

Right now my result will be something like 54.867563547, and not 54.86, as my wish is.

Can you help ?
AnswerRe: Display only 2 digs in string in label. Pin
Richard MacCutchan18-Apr-13 1:46
mveRichard MacCutchan18-Apr-13 1:46 
GeneralRe: Display only 2 digs in string in label. Pin
Søren Lyder Nielsen18-Apr-13 3:30
Søren Lyder Nielsen18-Apr-13 3:30 
GeneralRe: Display only 2 digs in string in label. Pin
Richard MacCutchan18-Apr-13 4:24
mveRichard MacCutchan18-Apr-13 4:24 
GeneralRe: Display only 2 digs in string in label. Pin
Søren Lyder Nielsen22-Apr-13 22:50
Søren Lyder Nielsen22-Apr-13 22:50 
GeneralRe: Display only 2 digs in string in label. Pin
Richard MacCutchan22-Apr-13 23:03
mveRichard MacCutchan22-Apr-13 23:03 
GeneralRe: Display only 2 digs in string in label. Pin
Søren Lyder Nielsen23-Apr-13 0:09
Søren Lyder Nielsen23-Apr-13 0:09 
GeneralRe: Display only 2 digs in string in label. Pin
Richard MacCutchan23-Apr-13 1:52
mveRichard MacCutchan23-Apr-13 1:52 
GeneralRe: Display only 2 digs in string in label. Pin
Søren Lyder Nielsen23-Apr-13 2:26
Søren Lyder Nielsen23-Apr-13 2:26 
GeneralRe: Display only 2 digs in string in label. Pin
Richard MacCutchan23-Apr-13 2:28
mveRichard MacCutchan23-Apr-13 2:28 
GeneralRe: Display only 2 digs in string in label. Pin
Søren Lyder Nielsen23-Apr-13 2:32
Søren Lyder Nielsen23-Apr-13 2:32 
GeneralRe: Display only 2 digs in string in label. Pin
Richard MacCutchan23-Apr-13 3:55
mveRichard MacCutchan23-Apr-13 3:55 
GeneralRe: Display only 2 digs in string in label. Pin
Søren Lyder Nielsen23-Apr-13 4:42
Søren Lyder Nielsen23-Apr-13 4:42 
GeneralRe: Display only 2 digs in string in label. Pin
Richard MacCutchan23-Apr-13 4:49
mveRichard MacCutchan23-Apr-13 4:49 
AnswerRe: Display only 2 digs in string in label. Pin
Member 1000269911-May-13 0:46
Member 1000269911-May-13 0:46 
GeneralRe: Display only 2 digs in string in label. Pin
Richard MacCutchan11-May-13 4:10
mveRichard MacCutchan11-May-13 4:10 
QuestionC++ Windows Form Application Printing Pin
eakteam16-Apr-13 10:37
professionaleakteam16-Apr-13 10:37 
AnswerRe: C++ Windows Form Application Printing Pin
NotPolitcallyCorrect16-Apr-13 12:01
NotPolitcallyCorrect16-Apr-13 12:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.