您的位置:首页 > 其它

自己闲来没事写了个九九乘法表 ,新手入门。大家看看就好。

2017-10-24 17:17 525 查看
自己闲来没事写了个九九乘法表 ,新手入门。

1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Web;
5 using System.Web.Mvc;
6
7 namespace WebApp_Mvc_Wg_Api.Controllers
8 {
9     public class DemoController : Controller
10     {
11         // GET: Demo
12         public ActionResult Index()
13         {
14             return View();
15         }
16         public ActionResult chenfabiao()
17         {
18             jiafabiao();
19
20             List<string> list = new List<string>();
21             for (int x = 1; x <= 9; x++)
22             {
23                 for (int y = 1; y <= 9; y++)
24                 {
25                     string formula = y + " * " + x + " = " + (x * y);
26                     formula = y > x ? " 焱 " : formula;
27                     list.Add(formula);
28                 }
29             }
30             ViewData["chenfabiao"] = list.ToList();
31             return View(ViewData["chenfabiao"]);
32         }
33
34         public ActionResult jiafabiao()
35         {
36             List<string> list = new List<string>();
37             for (int x = 1; x <= 9; x++)
38             {
39                 for (int y = 1; y <= 9; y++)
40                 {
41                     string formula = y + " + " + x + " = " + (x +y);
42                     formula = y > x ? " 焱 " : formula;
43                     list.Add(formula);
44                 }
45             }
46             ViewData["jiafabiao"] = list.ToList();
47             return View(ViewData["jiafabiao"]);
48         }
49
50     }
51 }


Controllers Code
页面结构

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐