Cast to decimal : Decimal « Data Type « Visual C++ .NET






Cast to decimal

 

#include "stdafx.h"

using namespace System;

void main()
{

    Decimal x = (Decimal)0.1234567890123456789012345678; // will get truncated 
    Decimal y = (Decimal)0.0000000000000000789012345678; // works fine

    Console::WriteLine( x );
    Console::WriteLine( y );
}

   
  








Related examples in the same category

1.Decimal calculation
2.Decimal constructor
3.Using Decimal constructor
4.Break decimal up into 4 parts
5.Decimal literal assigned