❶ 在C++中怎麼實現求X的Y次方
main(){ int x,y,sum; cin>>"input x:">>x>>endl; cin>>"input y:">>y>>endl; for(int n=0;n<=y;n++) sum*=x; cout<<"x^y="<<sum<<endl;} 樓上說的錯了!!