當前位置:首頁 » 編程軟體 » 編程圖案題

編程圖案題

發布時間: 2023-02-11 04:00:22

❶ 幾個vb編程題(圖形操作)

1.在form中加入如下代碼,在窗體上添加兩個按鈕command1,command2和一個picturebox名為picture1。Const Pi = 2 * 3.14
Private Sub Command1_Click()
Dim x As Single, y As Single, α, r As Single
Picture1.Scale (-4, 4)-(4, -4)
Picture1.Line (0, 4)-(0, -4)
Picture1.Line (4, 0)-(-4, 0)
r = 4
For α = 0 To Pi Step 0.01y = r * Cos(4 * α) * Sin(2 * α)
x = r * Cos(4 * α) * Cos(4 * α)
Picture1.PSet (x, y)
NextEnd SubPrivate Sub Command2_Click()
Unload Me
End Sub
2.在form中加入如下代碼,在窗體上添加兩個按鈕command1,command2和一個picturebox名為picture1。Const Pi = 2 * 3.14
Private Sub Command1_Click()
Dim x As Single, y As Single, α, r As Single
Dim n, i As Integer
Picture1.Scale (-4, 4)-(4, -4)
r = 3
For α = 0 To Pi Step 0.01y = r * Sin(α)
x = r * Cos(α)
Picture1.PSet (x, y)
Next
n = InputBox("請輸入等分數並且必須為正整數:")
If n Mod 2 = 1 Then
For i = 0 To (n + 1) / 2
y = r * Sin(i * Pi / n)
x = r * Cos(i * Pi / n)
Picture1.Line (x, y)-(-x, -y)
Next
Else
For i = 0 To n / 2
y = r * Sin(i * Pi / n)
x = r * Cos(i * Pi / n)
Picture1.Line (x, y)-(-x, -y)
Next
End IfEnd SubPrivate Sub Command2_Click()
Picture1.Cls
End Sub 3.在form中添加如下代碼,並添加一個command1按鈕和一個picturebox控制項名為picture1Private Sub Command1_Click()
Dim i As Integer
Dim a(19) As Integer
Form1.AutoRedraw = True
Randomize Timer
i = 0
c = False
Do While i < 20
b = Int(Rnd * 40) + 1
For j = i To 0
If a(i) = b Then c = True
Next j
If Not c Then
a(i) = b
i = i + 1
c = False
End If
Loop Picture1.Scale (-50, 50)-(50, -50)
For i = 0 To 19
Picture1.DrawWidth = (i Mod 5) + 1
Picture1.ForeColor = i
If i < 19 Then
Picture1.Line (a(i), a(i + 1))-(-a(i), -a(i + 1)), ColorGetByRndValue
Else
Picture1.Line (a(i), a(0))-(-a(i), -a(0)), ColorGetByRndValue
End If
Next
End Sub Function ColorGetByRndValue() As Long
Dim tOutLong As Long
Dim tColorCount As Long
Dim tColorValue As Long
tColorCount = 2 ^ 24
tColorValue = Rnd * tColorCount
tOutLong = CLng(Rnd * tColorCount)
ColorGetByRndValue = tOutLong
End Function

❷ 三道簡單的編程題

不知道你學的是什麼語言,我是學C的,先把源程序先貼出來,如果你看不懂,可以再補充提問,我再把方法告訴你!
1.
#include<stdio.h>
#include<conio.h>
main()
{
int a,b,c,d,m,in,out;
scanf("%d%d%d%d",&a,&b,&c,&d);
m=2.5*a+1.8*b+2*c+1.6*d;
printf("%d\n",m);//輸出應付錢數
scanf("%d",&in);
out=in-m;
printf("%d\n",out);//輸出應找的錢數
getch();
}

2.
#include<stdio.h>
#include<conio.h>
main()
{
char c1,c2,c3,c4,c5;
scanf("%c%c%c%c%c",&c1,&c2,&c3,&c4,&c5);
c1=c1+4;
c2=c2+4;
c3=c3+4;
c4=c4+4;
c5=c5+4;
printf("%c%c%c%c%c\n",c1,c2,c3,c4,c5);
getch();
}

第三題的圖案沒有顯示出來,不知道「中」有多大,你只要按照它的形狀列印就可以了

❸ C語言編程題 哪位大神幫忙看看怎麼做 輸出以下圖案

as3:核心程序

//var:定義變數

//trace:測試時簡單輸出

方法1:

func1();

function func1(n:uint=5){

var arr:Array=[];

for(var i:uint=0;i<2*n+1;i++){

arr.push([])

for(var j:uint=0;j<2*n+1;j++){

arr[i]+=Math.abs(j-n)<=Math.abs(i-n)?"*":" "}

trace(arr[i])}}

方法2:

function func2(n:uint=5){

for(var i:uint=0,str:String;i<2*n+1;i++){

str="";

for(var j:uint=0;j<2*n+1;j++){

str+=Math.abs(j-n)<=Math.abs(i-n)?"*":" "}

trace(str)}}

熱點內容
sqlwhencasethen 發布:2024-05-05 23:27:51 瀏覽:640
模架編程軟體 發布:2024-05-05 23:26:54 瀏覽:481
存儲過程異常 發布:2024-05-05 23:24:03 瀏覽:397
winxp訪問不了win7 發布:2024-05-05 23:05:23 瀏覽:733
演算法牛 發布:2024-05-05 22:43:40 瀏覽:719
grublinux引導 發布:2024-05-05 22:37:56 瀏覽:215
unix高級編程第三版pdf 發布:2024-05-05 22:32:09 瀏覽:958
手機wap網站源碼 發布:2024-05-05 22:27:44 瀏覽:259
python修改文件某一行 發布:2024-05-05 22:18:22 瀏覽:457
md5加密64 發布:2024-05-05 21:59:30 瀏覽:527