Solved

Decimal problem?

Posted on 2006-11-06
11
1,308 Views
Last Modified: 2012-08-13
The following assignment generates a compilation error:

decimal accountBalance = 1550.30;

This code generates the error. "Literal of type double cannot be implicitly converted to type 'decimal';...". To avoid this error, which suffix would you append to the literal value?
0
Comment
Question by:mathieu_cupryk
  • 4
  • 4
  • 3
11 Comments
 
LVL 22

Expert Comment

by:_TAD_
Comment Utility


if I am not mistaken, this should work....


decimal accountBalance = 1550.30m;

0
 
LVL 22

Expert Comment

by:_TAD_
Comment Utility


if I am not mistaken, this should work....


decimal accountBalance = 1550.30m;

0
 
LVL 22

Expert Comment

by:_TAD_
Comment Utility


if I am not mistaken, this should work....


decimal accountBalance = 1550.30m;

0
 
LVL 15

Accepted Solution

by:
ozymandias earned 250 total points
Comment Utility
decimal accountBalance = 1550.30M;
0
 
LVL 15

Expert Comment

by:ozymandias
Comment Utility
I think you need uppercase M.
TAD...you are posting everything 3 times dude.
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 

Author Comment

by:mathieu_cupryk
Comment Utility
It should be big M
0
 
LVL 15

Expert Comment

by:ozymandias
Comment Utility
Is this a quiz ?
0
 

Author Comment

by:mathieu_cupryk
Comment Utility
No I am helping a friend with some practice questions.



0
 

Author Comment

by:mathieu_cupryk
Comment Utility
It is to help us improve.
0
 
LVL 22

Expert Comment

by:_TAD_
Comment Utility

Nope, it doesn't matter.

m and M work equally well.


...and I can't help the triple post.  sometimes it posts multiple times and sometimes it does not.  I think it may be the proxy server I'm going through.
0
 
LVL 15

Expert Comment

by:ozymandias
Comment Utility
> m and M work equally well
Wow. I did not know that. Never tried it. I am a bit surprised actually.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now