<ol start="1" class="dp-c" style="padding: 0px; border: none; list-style-position: initial; list-style-image: initial; color: rgb(92, 92, 92); font-family: Consolas, 'Courier New', Courier, mono, serif; line-height: 35px; margin: 0px 0px 1px 45px !important;"><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(245, 250, 226); color: inherit; line-height: 18px;"><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;"><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit;">// </span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;"> </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(245, 250, 226); color: rgb(85, 85, 85); line-height: 18px;"><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;"><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit;">// Copyright (c) 2014软件技术1班 </span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;"> </span></span><span class="comment" style="background-color: inherit; margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0);">// All rights reserved. </span><span style="background-color: inherit; color: black; margin: 0px; padding: 0px; border: none;"> </span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(245, 250, 226); color: rgb(85, 85, 85); line-height: 18px;"><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;"><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit;">// 作 者:A08梁运基 </span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;"> </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(245, 250, 226); color: inherit; line-height: 18px;"><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;"><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit;">// 完成日期:2014年 11月 30 日 </span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;"> </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(245, 250, 226); color: rgb(85, 85, 85); line-height: 18px;"><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;"><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit;">// 版 本 号:v1.0 </span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;"> </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(245, 250, 226); color: inherit; line-height: 18px;"><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;"><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit;">// </span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;"> </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(245, 250, 226); color: rgb(85, 85, 85); line-height: 18px;"><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;"><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit;">// 问题描述:创建一个程序来计算人品。该程序提示用户输入姓名,然后显示出人品的数值以及评论。 </span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;"> </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(245, 250, 226); color: inherit; line-height: 18px;"><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;"><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit;">// 输入描述:一个字符串 </span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;"> </span></span></li><li style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(245, 250, 226); color: rgb(85, 85, 85); line-height: 18px;"><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;"><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit;">// 程序输出: </span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;"> </span></span></li><li class="alt" style="margin: 0px !important; padding: 0px 3px 0px 10px !important; border-style: none none none solid; border-left-width: 3px; border-left-color: rgb(153, 153, 153); list-style: decimal-leading-zero outside; background-color: rgb(245, 250, 226); color: inherit; line-height: 18px;"><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;"><span class="comment" style="margin: 0px; padding: 0px; border: none; color: rgb(0, 130, 0); background-color: inherit;">// </span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;"> </span></span></li></ol>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsolePersonality
{
class Program
{
static void Main(string[] args)
{
Console.Title = "人品计算机控制台版本2.0";
Console.WriteLine("请输入姓名");
string strName = "";
strName = Console.ReadLine();
int score = 0;
for (int i = 0; i < strName.Length; i++)
{
score += (int)strName[i];
}
score %= 100;
string comment = "";
if (score < 20) comment = "你污染了地球";
else if (score < 40) comment = "活在世上是一种罪啊!";
else if (score < 60) comment = "快还“百元哥”的钱";
else if (score < 80) comment = "你是难能可贵的人才啊!";
else if (score > 80) comment = "你是宇宙的拯救者!奋斗吧少年";
Console.Clear();
Console.WriteLine("人品评估报告");
Console.WriteLine("姓名:{0}", strName);
Console.WriteLine("分值:{0}", score);
Console.WriteLine("评价:{0}", comment);
Console.ReadKey(true);
}
}
}
运行结果如下