程式設計輸出以下圖形

2021-03-06 11:01:25 字數 1150 閱讀 4192

1樓:匿名使用者

public function diamond(byval num as integer) as string

dim i, j as integer, st as string = ""

if (num mod 2 = 0) thenreturn ""

end if

'輸出上三角形

for i = 1 to (num + 1) \ 2for j = 1 to (num + 1) / 2 - ist = st & " "

next

for j = 1 to 2 * i - 1st = st & "*"

next

st = st & vbcrlf

next

'輸出下三角形

for i = 1 to (num - 1) \ 2for j = 1 to i

st = st & " "

next

for j = 1 to num - 2 * ist = st & "*"

next

st = st & vbcrlf

next

return st

end function

private sub button7_click(byval sender as system.object, byval e as system.eventargs) handles button7.

click

dim str as string = ""

str = diamond(7)

textbox6.text = str

end sub

2樓:聽不清啊

#include

int main()

for(i=n-2;i>=0;i--)

return 0;}

3樓:兄弟連教育北京總校

#define line 10 /*控制顯示的行*/

#define row 20 /*控制顯示的列*/void paintstar(int y, int x, int num)

main()

;row = row;

for(line=0; line<7; line++)}

急急急!編寫大一VB程式設計 輸出如下圖形(共四行,第一行,第二行,第三行,第四行

private sub mand1 click dim i for i 1 to 4 print tab 7 i string i 2 1,next end sub for i 1 to 4 for j 1 to 2 i 1 print next j print next i for i 1 to ...

c語言題目程式設計輸出如下圖案C語言題目程式設計輸出如下圖案一個三個五個七個五個三個一個

include int main printf n 這個for 輸出下半個三角形 for i 7 i 1 i printf n return 0 include include void main int i,j,n 3 n值的選取根據所列印菱形的邊長而定,本例取3 for i n i n i fo...

C語言程式設計程式設計實現將陣列逆序輸出

1 首先開啟軟體vc 6.0軟體,準備一個空白的c語言檔案,引入標頭檔案並寫好主函式 2 然後輸入 首先定義陣列,接著用一個for迴圈接受使用者輸入的陣列元素並將其列印到螢幕上,並儲存到前面的陣列中,然後用第二個for迴圈逆序排序,方法就是前面的元素和後面的元素比較大小,前面比後面小就交換順序,最後...