level 1
hubuabcueu
楼主
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
double a, b;
Console.WriteLine("请输入x");
String s = Console.ReadLine();
a = double.Parse(s);
if (a >= 0)
b = (Math.Pow(a, 2) - 3 * a) + 2 * Math.PI + Math.Sin(a);
if (a < 0)
b = Math.Log(-5 * a) + 6 * Math.Sqrt(Math.Abs(a) + Math.Exp(4)) - Math.Pow(a + 1, 3);
Console.WriteLine("Y={0}", b);
}
}
}
complie的时候说是使用了未赋值的变量b,额,搞不懂,有大仙儿给点下吗?
2011年03月03日 10点03分
1
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
double a, b;
Console.WriteLine("请输入x");
String s = Console.ReadLine();
a = double.Parse(s);
if (a >= 0)
b = (Math.Pow(a, 2) - 3 * a) + 2 * Math.PI + Math.Sin(a);
if (a < 0)
b = Math.Log(-5 * a) + 6 * Math.Sqrt(Math.Abs(a) + Math.Exp(4)) - Math.Pow(a + 1, 3);
Console.WriteLine("Y={0}", b);
}
}
}
complie的时候说是使用了未赋值的变量b,额,搞不懂,有大仙儿给点下吗?