//例 输入8 输出8=2*2*2 #include<iostream> using namespace std; int main() { int a, k = 1; while (k) { cout << "请输入一个正整数:" << endl; cin >> a; int i = 2; cout << a << "="; for (int j = 0; j < 100; j++) { if (a%i == 0) { a = a / i; cout << i; if (a != 1) cout << "*"; } else { i++; } } if (a != 1) { cout << a ; } cout << endl; } return 0; }