S001-AC.cc
545 Bytes
#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;
}