3 c++
LANGUAGE:C++ 你好,在下面的函数(代码块)中我写了一行来打印字符之间的空格,但我不想在最后一个字符后面打印空格.我怎么解决这个问题?
bool perfecto(int n)
{
int suma, i;
suma = 0;
for (i = 1; i < n; i++)
{
if (n % i == 0)
{
suma += i;
cout << i << " ";
}
}
if (suma == n)
return true;
else
return false;
}
Run Code Online (Sandbox Code Playgroud)
最好的祝福.ÁngelManuel.
| 归档时间: |
|
| 查看次数: |
3850 次 |
| 最近记录: |