#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
cout << "(輸入0以下的數字可重新輸入)" << endl;
int XXX=0, OOO, XOX=1,r=0;
re:
cout << "-------------------------------------" << endl;
cout << "請輸入一整數: ";
cin >> XXX;
if (XXX < 0)
{
goto re;
}
cout << "請輸入整數的次方: ";
cin >> OOO;
if (OOO < 0)
{
goto re;
}
for (int i = 1; i <= OOO; i++)
{
XOX *= XXX;
}
cout << XXX << "的" << OOO << "次方是" << XOX << endl;
} |