*********************************************************** ****** ****************************************** ****** ***** ***************************************** ***** ***** ****** ************ **** **** ******* ******* *** ****** ********* *** *** *************** *** *** ********** *** ************** ** **** ****** *************** ************* *********** ***** ***** *********** *************** **************** **** ************ ********** ****************** *** ************ ************** **************** ***** ************* **************** **************** ******* ************** ******** *************** ******** *********** ***** ************ ********* **** ************** *********** ******* ******** ***** *********** ******** **************** *********************** ************************************************************で囲まれた中を塗りつぶす基本的な VC++ の「再起関数」のプログラムです。
前田稔(Maeda Minoru)の超初心者のプログラム入門
ファイル名 | 説明 |
---|---|
Paint.cpp | 塗りつぶし |
/*★ 内部を塗りつぶす 前田 稔 ★*/ #include <stdio.h> #include <conio.h> char t[20][60]= // "....:....1....:....2....:....3....:....4....:....5....:....6", { "***********************************************************", //1 ページ先頭の図形を参照して下さい "***********************************************************" //20 }; |
//★ MAIN PROGRAM int main() { int y; paint(20,5); for(y=0; y<20; y++) puts(t[y]); getch(); return(0); } |
//内部を塗りつぶす void paint(int x,int y) { if (t[y][x]=='*') return; t[y][x]= '*'; paint(x+1,y); paint(x-1,y); paint(x,y+1); paint(x,y-1); } |