是否存在可以用一定数量的符号表示的求和函数

问题描述 投票:0回答:1

我想问我如何用字符串中的符号“ *”表示int的金额例如。

int a=int.parse(console.ReadLine)
a=1 then cosole.WriteLine"*"
a=2 then write"**" 

因此继续3 = *** 4 = ****谢谢

c# string int
1个回答
0
投票

您可以使用String构造函数重载String(char c, int n),该重载将使用字符String(char c, int n)并将其重复c次:

n
© www.soinside.com 2019 - 2024. All rights reserved.