提交时间:2024-01-29 15:33:08

运行 ID: 38985

#include <iostream> using namespace std; class QualityFactor { private: int n; public: void QFContract(long a) { n = 0; while(a>1) { for(int i=2;i<=a;i++) { if(a%i==0) { a = a/i; cout << i << " "; break; } } } cout << endl; } }; int main(int argc, char* argv[]) { QualityFactor QF; long number; cout << "输入要解的合数" << endl; cin>>number; QF.QFContract(number); system("pause"); return 0;