本文最后更新于 1524 天前,其中的信息可能已经有所发展或是发生改变。
[sourcecode language=”c”]
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Console.Write("请输入一个数:");
string str = Console.ReadLine();
double y, x;
x = double.Parse(str);
if (x >= 0)
{
y = Math.Sin(x) + 2 * Math.Sqrt(x + Math.Exp(4)) – Math.Pow(x + 1, 3);
}
else
{
y = Math.Log(-5 * x) – Math.Abs(x * x – 8 * x) / (7 * x) + Math.E;
}
Console.WriteLine("输入值为{0},结果值为{1}",x, y);
Console.ReadKey();
}
}
}
[/sourcecode]