资源描述:
《vb程序高一版(high version of the vb program)》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、vb程序高一版(HighversionoftheVBprogram)2.1VBlanguageandprogramdevelopmentenvironmentChickenwithrabbitcagePrivate,sub,command1_click()A=inputbox("a=","enterthenumberofheads")B=inputbox("b=","enterthenumberoffeet")X=2*a-b/2Y=b/2-aPrint"chickennumberx=";X,"rabbitnumbery=";yEndsubAnumber
2、thatcanbedivisibleby3within100Private,sub,command1_click()I=1DoIf,I,mod,3=0,then,print,II=i+1Loopuntili>100EndsubgreatestcommonfactorPrivate,sub,command1_click()M=9147485N=5147480R=mmodnDowhiler<>0M=nN=rR=mmodnLoop"Print=GCD";nEndsubFindtheareaofacirclewhoseradiusisRPrivate,sub,
3、command1_click()ConstPiassingle=3.14Dim,R,as,single,s,as,singleR=inputbox("r=","enterradius")S=pi*r*rPrint"theareaofthecircleisS=";SEndsubI.Basicdatatypes1,integer(integer),suchas:1,2,3....2,long(longinteger),suchas:1234567893,single(singleprecisionrealtypenumber),suchas:3.14159
4、4,double(doubleprecisionrealnumber),suchas:1.23456D+155,date(time)(datetype)6,string(charactertype)7,Boolean(logic)hasonlytwovalues:true/falseTwo,constantsandvariables1,constantDescriptionformat:Constconstantnameastype=expression2variablesDescriptionformat:DimvariablenameastypeT
5、hreeoperators,functionsandexpressionsOperatorsarearithmeticoperators,stringoperators,andlogicaloperators1,arithmeticoperators:+,-,*,/,^,*,MOD2stringoperators:&3、logicaloperators:and,or,notFunction:Functionname(parametertable)Expression:Referstoanevaluationrule,whichiscomposedofp
6、airedparenthesesoperatorandlinkingvariables,constants,functionssuchasoperandreasonableform.Thesequentialstructureofthesecondprogram.PptCalculationofthelivingexpensesof2.2.1residents2-1:accordingtothefoodrationstandardrecommendedbytheNationalInstituteofnutritionandayearinruralhou
7、seholdsurveydata,thenumberofCountyRuralHouseholdsbasicfoodconsumption(peryear),andtheunitpriceasshowninthefollowingtable.TheprojectofgrainandvegetableoilpotatomeateggsfishmilkfruitDriedtofuQuantity(kg)170144336181266,2410Unitprice(yuan/kg)2.46,1.42,9.41,1.14,12.74,2.49,6.67,9.32
8、,2.64,,2.07(1)seekbasicfoodconsumptionexpenditu