首页 > 分享 > C语言实现绘制南丁格尔玫瑰图的示例代码

C语言实现绘制南丁格尔玫瑰图的示例代码

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

106

107

108

109

110

111

112

113

114

115

116

117

118

119

120

121

122

123

124

125

126

127

128

129

130

131

132

133

134

135

136

137

138

139

140

141

142

143

144

145

146

147

148

149

150

151

152

153

154

155

156

157

158

159

160

161

162

163

164

165

166

167

168

169

170

171

172

173

174

175

176

177

178

179

180

181

182

183

184

185

186

187

188

Canvas cs ;    

float pi=3.1415926535 ;

float a ;           

float r ;            

int i, j, n ;

float x0,y0,x1,y1 ; 

float dx,dy ;            

string ss, ss1, ss2 ;        

 int p[6] ;       

double pn ;  

RoseChart10 (){     

    cs.ClearDraw (0,src);  

      clearOutput();

      selectStyle () ;

      cs.SetFillMode (1);

      cs.SetColor (255,250,250,250);

      cs.DrawRect (0,4,720,600);  

      cs.SetColor (255,140,140,140);

      cs.DrawRect (24,24,706,586);  

      cs.SetColor (255,240,240,250);

      cs.DrawRect (20,20,700,580);  

      cs.SetFillMode (0);

      cs.SetColor (255,0,0,240);

      cs.DrawRect (20,20,700,580);  

      cs.DrawRect (24,24,696,576);  

      cs.SetStrokeWidth(0);   

              dx=360;  dy=280 ;    

      cs.SetFillMode (1);

      cs.SetColor(255,80,20,250); 

      cs.DrawCircle(dx,dy,215);    

 int cr,cg,cb;     

      for (i=1; i<=11 ; i++){ 

               cb=200-i*25 ; 

               L=cb+40 ;

          cs.SetColor(255,80,0,cb);

          cs.DrawCircle(dx,dy,L);       } 

               cs.SetColor(255,80,0,40);

          cs.DrawCircle(dx,dy,15);    

          cs.SetTextStyle (1);

          cs.SetStrokeWidth(1);

          cs.SetColor(255,250,0,0);

          cs.SetTextSize (16);

     for (i=1; i<=10 ; i++){  

            a=pi/360*i ;

            x0=(float)(200*cos (a))+dx ;

            y0=(float)(200*sin (a))+dy ;

        cs.SetFillMode (0);

        cs.SetColor(255,250,250,250);

        cs.DrawCircle(dx,dy,i*20); 

            x1=(float)(i*20*cos (a))+dx ;

            y1=(float)(i*20*sin (a))+dy ;

             ss=intToString (i);

         cs.SetFillMode (1);

         cs.SetColor(255,250,250,0);

         cs.DrawText(ss,x1-5,285);         } 

          cs.SetTextSize (18);

          cs.SetColor(255,250,0,0);

    for (i=0; i<=5 ; i++){  

          a=pi/360*i*120 ;  

          x0=(float)(220*cos(a))+dx ;

          y0=(float)(-220*sin(a))+dy ;

          cs.DrawLine (x0,y0,dx,dy);  

          a=pi/360*i*120+120 ;      

          x1=(float)(225*cos(a))+dx-5 ;

          y1=(float)(-225*sin(a))+dy+5 ; 

               ss=intToString (i+1) ;

          cs.DrawText (ss,x1,y1) ;              } 

          cs.SetColor (255,220,200,250);

          cs.DrawRect (550,80,685,180);  

              cs.SetColor (255,250,0,0);

          cs.DrawRect (630,90,670,110);  

          cs.DrawText ("Group A", 560,105) ;                

              cs.SetColor (255,0,250,0);

          cs.DrawRect (630,120,670,140);  

          cs.DrawText ("Group B", 560,135) ;                

              cs.SetColor (255,250,250,0);

          cs.DrawRect (630,150,670,170);  

          cs.DrawText ("Group C", 560,165) ;                

int p1[6], p2[6], p3[6] ;

int L ;     

        cs.SetStrokeWidth(2);   

        cs.SetFillMode (1);

     p1[0]=70; p1[1]=85; p1[2]=68; p1[3]=94;

     p1[4]=60; p1[5]=75;

    for (n=0; n<=5 ; n++){

            r=p1[n]+120 ;   

       for (i= n*120+20; i<=n*120+100; i++){ 

              cs.SetColor(200,250,0,0);

              a=pi/360*i ;    

           x0=(float)(r*cos (a))+dx ;    

           y0=(float)(-r*sin (a))+dy ;    

           cs.DrawLine (dx,dy,x0,y0);    

      cs.DrawRect (80,n*25+52,120,n*25+74);

          cs.SetTextStyle (0);

          cs.SetTextSize (18);

          cs.SetColor(255,0,0,250);

          s=intToString(n+1)+" >   "+intToString (p1[n]);

          cs.DrawText (s, 55,70+n*25);

               cs.Update ();     }   }

     p2[0]=78; p2[1]=65; p2[2]=69; p2[3]=70;

     p2[4]=80; p2[5]=95;

    for (n=0; n<=5 ; n++){

            r=p2[n]+80 ;   

       for (i= n*120+20; i<=n*120+100; i++){ 

              cs.SetColor(200,0,250,0);

              a=pi/360*i ;    

           x0=(float)(r*cos (a))+dx ;    

           y0=(float)(-r*sin (a))+dy ;    

           cs.DrawLine (dx,dy,x0,y0);    

      cs.DrawRect (80,n*25+213,120,n*25+234);

          cs.SetTextStyle (0);

          cs.SetTextSize (18);

          cs.SetColor(255,0,0,250);

          s=intToString(n+1)+" >   "+intToString (p2[n]);

          cs.DrawText (s, 55,230+n*25);

               cs.Update ();      }   }

     p3[0]=50;  p3[1]=75; p3[2]=88; p3[3]=85;

     p3[4]=97;  p3[5]=70;

     for (n=0; n<=5 ; n++){

            r=p3[n]+40 ;   

       for (i= n*120+20; i<=n*120+100; i++){ 

              cs.SetColor(150,250,250,0);

              a=pi/360*i ;    

           x0=(float)(r*cos (a))+dx ;    

           y0=(float)(-r*sin (a))+dy ;    

           cs.DrawLine (dx,dy,x0,y0);    

      cs.DrawRect (80,n*25+373,120,n*25+394);

          cs.SetTextStyle (0);

          cs.SetTextSize (18);

          cs.SetColor(255,0,0,250);

          s=intToString(n+1)+" >   "+intToString (p3[n]);

          cs.DrawText (s, 55,390+n*25);

               cs.Update ();      }   }

       cs.SetFillMode (0);

        cs.SetStrokeWidth(2);

        cs.SetColor(255,250,0,0);   

        cs.DrawCircle(dx,dy,215); 

        cs.SetColor(255,0,250,0);   

        cs.DrawCircle(dx,dy,180); 

        cs.SetColor(255,250,250,0);   

        cs.DrawCircle(dx,dy,140); 

      cs.SetFillMode (1);

      cs.SetTextStyle (1);

      cs.SetStrokeWidth(1);

           cs.SetTextSize (26);

      cs.SetColor(255,0,0,250);  

      cs.DrawText ("Rose Chart ",500,60) ;

      cs.SetTextSize (50);

         ss="统计图  -  玫瑰图" ;

      cs.SetColor(255,50,120,20);     

           cs.DrawText (ss,164,534);   

      cs.SetColor(255,0,250,0);

           cs.DrawText (ss,160,530);   

      cs.SetFillMode (0);

      cs.SetColor(255,250,150,0);

           cs.DrawText (ss,160,530);   

       cs.Update ();

}

相关知识

C语言情人节玫瑰花代码
如何用c语言编程玫瑰花
C语言烟花代码,C语言实现烟花表白代码
如何用c语言输出一朵花
在线制作南丁格尔玫瑰图
如何使用C语言制作表白神器
python玫瑰花代码简单
如何用c 编写玫瑰花代码 – PingCode
c语言樱花飘落代码
python玫瑰花代码讲解

网址: C语言实现绘制南丁格尔玫瑰图的示例代码 https://m.huajiangbk.com/newsview1548714.html

所属分类:花卉
上一篇: WPS怎么设计花朵小图标? wp
下一篇: 节理玫瑰花图的制作PPT课件.p