Declare Function GetEnvironmentStrings Lib "kernel32" Alias "GetEnvironmentStringsA" () As String
成都創(chuàng)新互聯(lián)公司專注于江北企業(yè)網(wǎng)站建設(shè),響應(yīng)式網(wǎng)站建設(shè),電子商務(wù)商城網(wǎng)站建設(shè)。江北網(wǎng)站建設(shè)公司,為江北等地區(qū)提供建站服務(wù)。全流程按需規(guī)劃網(wǎng)站,專業(yè)設(shè)計(jì),全程項(xiàng)目跟蹤,成都創(chuàng)新互聯(lián)公司專業(yè)和態(tài)度為您提供的服務(wù)
dim wolf as integer,sheep as integer,cai as integer
for wolf=0 to 1
if wolf=1 then print "wolf":i=i+1
if i=2 then print:i=0
for sheep=0 to 1
if wolf=1 then sheep=0
if sheep=1 then print "sheep":i=i+1
if i=2 then print:i=0
for cai=0 to 1
if sheep=1 then cai=0
if cai=1 then print "cai":i=i+1
if i=2 then print:i=0
next cai
next sheep
next wolf
Option Explicit On
Option Strict On
Imports System
Module Program
Sub Main()
Dim y,m,t As Integer
begin:
' 輸入數(shù)據(jù)時(shí)一行一個(gè)
y=CInt(Console.ReadLine())
m=CInt(Console.ReadLine())
t=CInt(Console.ReadLine())
If y
200 Then
Console.WriteLine("ERROR")
goto begin
End If
pr(y,m,t)
Console.Write("Press any key to continue . . . ")
Console.ReadKey(True)
End Sub
Function pr(y As Integer,m As Integer,t As Integer) As Integer
Dim ye,[Me],i As Integer
ye=CInt((m+t-2)/12+y)
[Me]=(m+t-2) Mod 12+1
End If
End Function
Function mday(y As Integer,m As Integer) As Integer
Dim day As Integer()={0,31,28,31,30,31,30,31,31,30,31,30,31}
Dim ad As I
Option Explicit On
Option Strict On
Imports System
Module Program
Sub Main()
Dim y,m,t As Integer
begin:
' 輸入數(shù)據(jù)時(shí)一行一個(gè)
y=CInt(Console.ReadLine())
m=CInt(Console.ReadLine())
t=CInt(Console.ReadLine())
If y100 Then
y=y+2000
End If
If y1916 OrElse m200 Then
Console.WriteLine("ERROR")
goto begin
End If
pr(y,m,t)
Console.Write("Press any key to continue . . . ")
Console.ReadKey(True)
End Sub
Function pr(y As Integer,m As Integer,t As Integer) As Integer
Dim ye,[Me],i As Integer
ye=CInt((m+t-2)/12+y)
[Me]=(m+t-2) Mod 12+1
Console.WriteLine(" {0}-{1} ~ {2}-{3}",y,m,ye,[Me])
ye=y
[Me]=m
For i=0 To t-1
prmonth(ye,[me])
[Me]=[Me]+1
If [Me]12 Then
ye=ye+1
[me]=1
End If
Next
Return 0
End Function
Function yam(y As Integer,m As Integer) As Integer
Dim st As String()={"未定義","一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"}
Console.WriteLine(" {0} {1}",y,st(m))
Console.WriteLine("----------------------------")
Return 0
End Function
Function ryear(y As Integer) As Integer
If 0=y Mod 400 OrElse (0y Mod 100 AndAlso 0=y Mod 4) Then
Return 1
Else
Return 0
End If
End Function
Function mday(y As Integer,m As Integer) As Integer
Dim day As Integer()={0,31,28,31,30,31,30,31,31,30,31,30,31}
Dim ad As Integer=0
If 2=m Then
ad=ryear(y)
End If
Return day(m)+ad
End Function
Function monday(y As Integer,m As Integer) As Integer
Dim md As Integer=6
Dim i,daynum As Integer
For i=1916 To y-1
daynum=365+ryear(i)
md=(md+daynum) Mod 7
Next
For i=1 To m-1
md=(md+mday(y,i)) Mod 7
Next
Return md
End Function
Function prmonth(y As Integer,m As Integer) As Integer
Dim md As Integer=monday(y,m)
Dim daysnum As Integer=mday(y,m)
Dim days As Integer=daysnum+md
Dim i As Integer
yam(y,m)
Console.Write(" 日 一 二 三 四 五 六")
For i=0 To days-1
If 0=i Mod 7 Then
Console.WriteLine()
Console.WriteLine()
Console.Write(" ")
End If
If i-md=0 Then
Console.Write(" {0,2}",i-md+1)
Else
Console.Write(" ")
End If
Next
Console.WriteLine()
Console.WriteLine()
Return 0
End Function
End Module
C語(yǔ)言轉(zhuǎn)成VB不是可能,只是難度太大,你這10分實(shí)在太吝嗇了。
而且有一些是無(wú)法轉(zhuǎn)換的,例如你這句
#include "CRC.h"
這個(gè)CRC.h,VB語(yǔ)言是不兼容的。
我勸你還是好好學(xué)習(xí)吧。這種偷懶的事情,我大學(xué)里干過(guò),在處理實(shí)驗(yàn)數(shù)據(jù)時(shí),隨便抄了個(gè)程序(fortran語(yǔ)言),又怕都是發(fā)現(xiàn),于是把fortran語(yǔ)言轉(zhuǎn)成C語(yǔ)言,一心想著欺負(fù)老師看不懂(或者不熟悉)C語(yǔ)言,居然給蒙混過(guò)關(guān),一開(kāi)始還沾沾自喜,現(xiàn)在想起,兩種語(yǔ)言風(fēng)牛馬不相及,只不過(guò)是都是不愿意跟學(xué)生計(jì)較罷了,想起來(lái)真是慚愧。