急需答案啊··· 求大神解答
c#吧
全部回复
仅看楼主
level 4
让做一个程序随机撒两个筛子数然后让这两个数相加得出和 平且把和转换成对应数的符号··· 例如摇出来两个3和是6 就要显示出6个*号 前面都做出来就差这个转换符号了 求解 在线等答案啊···
2013年08月04日 23点08分 1
level 11
你要转换符号是什么意思?转换完成之后是图像还是字符串?其实办发还是挺多的,比如说使用索引器,索引是多少就取出对应的字段,最笨的办法还可以是使用if判断或者是for循环
------来自 爱贴吧HD for Windows8
2013年08月05日 00点08分 2
就是转换成字符串 比如结果是个6 后面就显示出 ****** 6个*号 本人小白 刚开始学··· 可以麻烦你说详细点么?
2013年08月05日 00点08分
回复@n35190630 :就是说,在你取的这个数字之后,使用for循环(i=随机数结果)然后打印*,打印多少个都无所谓,都是根据随机数来定的,代码大不了...刚做的系统,数据库都还没安装呢 ------来自 爱贴吧HD for Windows8
2013年08月05日 00点08分
可以随便打个地方截图给我么?刚学没几天··· 什么也不会···
2013年08月05日 00点08分
回复 n35190630 : for (i = 0; i < rnd;i++) { console.write("*"); }
2013年08月05日 01点08分
level 8
for循环呗 要不然声明一个空串 用PadLeft填充
2013年08月05日 00点08分 3
本人小白 麻烦写的详细点 谢谢··· 截图代码过来那便是极好的···
2013年08月05日 00点08分
level 15
这样?
2013年08月05日 01点08分 4
谢谢 大神 刚才试了可以用 可以把所有的结果都显示在一行中么?用这个方法我只会显示出两行的东西···
2013年08月05日 05点08分
回复 n35190630 : Console.WriteLine("The sum of two number is:{0}, mark is:{1}",x+y,""PadLeft(x+y),'*'); 这种?
2013年08月05日 06点08分
回复 白_蓝_红 : 好像有点问题额··· 我放出来 帮忙给看下好么?
2013年08月05日 20点08分
level 5
Random rm = new Random();
int x = rm.Next(1,6);
Console.WriteLine("The number is {0}",x);
int y = rm.Next(1,6);
Console.WriteLine("The number is {0}",y);
int sum = x + y;
Console.WriteLine("The sum of two number is {0}", sum);
for (int i = 1; i <= sum; i++)
{
Console.Write("*");
}
Console.ReadKey();
2013年08月05日 02点08分 5
多谢 这个可以用但是我前也有一个for循环 哪后面的这个还能用么? 要循环撒两百次筛子····[汗]
2013年08月05日 05点08分
回复 n35190630 :可以,把我给你的这个程序,再写在一个for循环就好了
2013年08月05日 07点08分
多谢···[勉强]
2013年08月05日 20点08分
回复 n35190630 : Console.WriteLine("mark1 is:{0} mark2 is:{1} sum is:{2} jieguo is :{3}",x,y,sum,"".PadLeft(sum,'*'));
2013年08月06日 01点08分
level 6
用for循环输出字符就是了
2013年08月05日 10点08分 6
好的 谢谢···
2013年08月05日 20点08分
level 11
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Random a = new Random();
int b = a.Next(1, 6);
int c = a.Next(1, 6);
int d = b + c;
for (int i = d; i >=0; i--)
{
Console.Write("*");
}
Console.ReadLine();
}
}
}
2013年08月05日 10点08分 7
多谢···[开心]
2013年08月05日 20点08分
level 4
各位大神给帮忙给看看为什么出错啊····
2013年08月05日 20点08分 8
"".padLeft(x+y),'*' 修改为 "".PadLeft(x+y, '*')
2013年08月06日 01点08分
还有就是,你那行输出的,有 {0} {1} {2} 但是后面跟了 4个参数, 分别是 x, y, x+y, "".PadLeft(x+y, '*') 你是不是要在前面适当的位置增加一个 {3} 呀?
2013年08月06日 01点08分
level 12
你这for循环200次是干嘛的?
2013年08月06日 01点08分 9
1