看板 Programming
作者 ott (寶貝)
標題 Re: [請益] 用遞迴實作巢狀迴圈
時間 2010年10月23日 Sat. PM 06:48:23
※ 引述《iloveyouever》之銘言:
※ 引述《abc1231qa》之銘言:
#include<iostream>
using namespace std;
int main()
{
int loop1=0 , loop2=0 , loop3=0 , loop4=0;
int inttemp[4];
char chartemp[4];
cin.getline(chartemp,4,'\0');
for(loop1=0;loop1<=2;loop1++)
inttemp[loop1]=chartemp[loop1]-48;
for(loop2=inttemp[0];loop2>=0;loop2--)
for(loop3=inttemp[1];loop3>=0;loop3--)
for(loop4=inttemp[2];loop4>=0;loop4--)
cout<<loop2<<loop3<<loop4<<endl;
return 0;
}
--
--
※ 來源: Disp BBS 看板: Programming 文章連結: http://disp.cc/b/33-Gzk
※ 作者: ott 時間: 2010-10-23 18:48:23 來自: 118-166-2-31.dynamic.hinet.net
※ 同主題文章:
Re: [請益] 用遞迴實作巢狀迴圈
10-23 18:48 ott