ניסיתי לקלוט מספר ממשי ולהציג אותו על המסך
עם decimal זה עובד יופי
float נותן לי ערך מקורב. למה?
using system;
using system.collections.generic;
using system.linq;
using system.text; namespace consoleapplicationfloat
{
class program
{
static void main(string[] args)
{
decimal x = decimal.parse(console.readline());
console.writeline(x);
// עד כאן עובד יופי
float y = float.parse(console.readline());
console.writeline(y);
/* ברוב המקרים קיבלתי מספר שונה מזה שהכנסתי
// הסברים יתקבלו בברכה
// יש פה קטע קצר כדי להשהות את המסך */
console.writeline("press any key to continue ...");
console.readline();
}
}
}
c# כמובן
תוקן על ידי ליד_הסנדק ב- 04/10/2011 00:32:40