我的家庭作业的最后一个问题。请帮忙。 我很困惑,甚至不知道从哪里开始。 如果你能给我一些评论,那就明白那会很棒。
开发一个菜单驱动的程序,输入一个数字X,并根据用户的选择,找到边RewriteEngine On
RewriteMap lowercase int:tolower
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} [A-Z]
RewriteRule .* index.php/$0 [PT,L]
RewriteRule (.*) ${lowercase:$1} [R,L]
的正方形区域,半径为x [Area = x2]
的圆的区域,或者边长为X [Area = 3.14 * x2]
的等边三角形的面积。使用案例结构来处理用户的菜单选择。在C#Math库中使用Sqrt方法。如果选择了无效的菜单选项,则显示错误消息
答案 0 :(得分:0)
//Develop a menu-driven program that inputs a number X and, at the user’s option,
//finds the area of a square with side x [Area = x2], the area of a circle with radius X [Area = 3.14 * x2],
//or the area of an equilateral triangle with side x [Area = Sqrt(3) / 4 * X2].
//Use a case structure to handle the user’s menu choice. Use the Sqrt method in the C# Math library.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int a = 0;
double b = 0;
Console.Write("Enter 1 for Area of square :\nEnter 2 For Area of Circle :\nEnter 3 for Equilateral Triangle :\n\n");
aa:
a = int.Parse(Console.ReadLine());
switch (a)
{
case 1:
Console.Write("\n\nEnter the Value of Side x : ");
b = double.Parse(Console.ReadLine());
double area = b * b;
Console.Write("\n\nThe area of square is {0}",area);
break;
case 2:
Console.Write("\n\nEnter the Value of Side x : ");
b = double.Parse(Console.ReadLine());
double circle = (3.14) * (Math.Pow(b, 2));
Console.Write("\n\nThe Area of Circle is {0}",circle);
break;
case 3:
Console.Write("\n\nEnter the Value of Side x : ");
b = double.Parse(Console.ReadLine());
double triangle = ((Math.Sqrt(3)) / 4) * (Math.Pow(b, 2));
Console.Write("\n\nThe Area of Triangle is {0}",triangle);
break;
default:
Console.Write("\n\nEnter Correct Number : ");
goto aa;
}
Console.Read();
}
}
}