用Code::Block寫的,本來想用VC寫,可惜不會。

//damody #include <iostream> int main() { unsigned long long a; long b = 1,d; char e; bool f; using namespace std; do { cout << "請輸入一個正整數:__________\b\b\b\b\b\b\b\b\b\b"; f = 1; b = 1; cin >> a; if (a > 0 and a <= 10000000) { while (a > 1) { b++; if (a % b == 0) { cout << b; d = 0; while (a % b == 0) { d++; a = a / b; } if (d != 1) cout << " ^ " << d; if (a > 1) cout << " * "; } } } else cout << "超出範圍!"; cout << endl; cout << "是否繼續?(y/n)"; cin.get(); e = getchar(); system("cls"); if (e != 'y') f = 0; } while (f == 1); return 0; }
arrow
arrow
    全站熱搜

    讓地獄深紅的天亮 發表在 痞客邦 留言(0) 人氣()