[removed] Display positive numbers with the plus sign

后端 未结 9 1503
既然无缘
既然无缘 2020-12-11 00:05

How would I display positive number such as 3 as +3 and negative numbers such -5 as -5? So, as follows:

1, 2, 3 goes into +1, +2, +3

but if those are

<
9条回答
  •  情书的邮戳
    2020-12-11 00:18

    something along the lines of:

    if (num > 0)
    {
       numa = "+" + num;
    }
    else
    {
       numa = num.toString();
    }
    

    and then print the string numa.

提交回复
热议问题