//
// Copyright (c) 2014软件技术1班
// A05 rights reserved.
// 作 者:A05黄婉菲
// 完成日期:2014年 11 月30日
// 版 本 号:v1.0
//
// 问题描述:人品计算机
// 输入描述:一个数
// 程序输出:人品评估
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication4
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("请输入名字");
string strName = "";
strName = Console.ReadLine();
int score=0;
int i=0;
foreach(int item in strName)
{
Console.WriteLine("{0}",score+=strName[i]);
}
score &= 100;
string comment="";
foreach (char name in strName)
if (score <= 20) comment = "基因突变的外星人,净化不完全的生命体,阴阳失调的黑猩猩";
else if (score <= 30) comment = "你复杂的五官,掩饰不了你朴素的智商";
else if (score <= 40) comment = "长的很无辜,长的对不起人民对不起党";
else if (score <= 50) comment = "如果我是你,很早以前我就会有想自杀的冲动";
else if (score <= 60) comment = "、你瞧你吧,看背影急煞千军万马,转过头吓退百万雄狮";
else if (score <= 70) comment = "我观察你很久了,终究还是觉得地球不适合你。我这有张去火星的票,给你吧";
else if (score <= 80) comment = "人见人爱,花见花开";
else if (score <= 90) comment = "英俊与智慧的化身,侠义与仁义的糅合";
else comment = "新时代的全能人类";
Console.WriteLine();
Console.WriteLine("人品评估报告");
Console.WriteLine("姓名:{0}", strName);
Console.WriteLine("分值:{0}", score);
Console.WriteLine("评估:{0}", comment);
Console.Read();
}
}
}<img width="819" height="458" style="width: 819px; height: 464px;" src="https://img-blog.csdn.net/20141130141235531?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvaHdmOTk4MjEw/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="" />
<img width="819" height="461" style="width: 819px; height: 481px;" src="https://img-blog.csdn.net/20141130141130921?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvaHdmOTk4MjEw/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="" />
小结:更熟悉foreach的用法,知道了怎么把名字转换成数值。