|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
#include <iostream>
#include <string>
#include <sstream>
using namespace std;
int main()
{
int product=0;
string str;
stringstream sstream;
while(1)
{
cin >> str;
if(cin.eof())
{
return 0;
}
do
{
product = str[0] - 48;
for(int i = 1; i < str.size(); i++)
{
product *= str[i] - 48;
}
cout << "The product of the digits of " << str << " is " << product << "." << endl;
sstream << product;
sstream >> str;
sstream.clear();
}while(str.size() != 1);
cout << "----------" << endl;
}
return 0;
}
|