扇形

#include <graphics.h>
#include <math.h>
#include <conio.h>
#include <time.h>
int main() {
    initgraph(640, 480);
    int n=9;
    srand(time(0));
    double start=0;
    while(1){
    	setfillcolor(RGB(rand()%256,rand()%256,rand()%256));
    	fillpie(220, 140, 420, 340,start,start+0.5); 
    	start+=0.5;
    	Sleep(200);
    	cleardevice();
	}
    getch();
    closegraph();
    return 0;
}















#include <graphics.h>
#include <math.h>
#include <conio.h>
#include <time.h>
int main() {
    initgraph(640, 480);
    int n=9;
    srand(time(0));
    float s[]={10,10,10,10,10,10,10,10,20};
    double start=0,swaap;
    for(int i=0;i<9;i++){
    	swaap=s[i]/100*2*3.1415;
    	setfillcolor(RGB(rand()%256,rand()%256,rand()%256));
    	fillpie(220, 140, 420, 340,start,start+swaap); 
    	start+=swaap;
	}
    getch();
    closegraph();
    return 0;
}

  

posted @ 2025-04-26 10:02  陈若麟  阅读(6)  评论(0)    收藏  举报