编写一个程序要求输入的整数的各位之和,如输入5684,该计算显示为5+6+8+4=23
C++描述
#include
using namespace std;
const MAX_SIZE=50;
int main()
{
int Stack[MAX_SIZE];
int len=0;
int current;
cin>>current;
while(current!=0)
{
Stack[len]=current%10;
len++;
current/=10;
}
int tag=0;
int result=0;
while(len!=0)
{
if(tag!=0)
cout<<'+';
cout<全部
C++描述
#include
using namespace std;
const MAX_SIZE=50;
int main()
{
int Stack[MAX_SIZE];
int len=0;
int current;
cin>>current;
while(current!=0)
{
Stack[len]=current%10;
len++;
current/=10;
}
int tag=0;
int result=0;
while(len!=0)
{
if(tag!=0)
cout<<'+';
cout< 收起