欢迎来到天天文库
浏览记录
ID:48810477
大小:448.00 KB
页数:49页
时间:2020-01-27
《(程式语言).ppt》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、ProgrammingLanguage(程式語言)Chapter6DataTypes(資料型態)TopicsIntroductionPrimitivedatatypes(基本資料型態)Characterstringtypes(符號字串型態)User-definedordinaltypes(使用者定義順序型態)Arraytypes(陣列型態)Associativearrays(關聯陣列)Recordtypes(紀錄型態)Uniontypes(聯合型態)Pointerandreferencetypes(指標與參考型態)2IntroductionDa
2、tatypedefinesAcollectionofdataobjectsandasetofpredefinedoperationsonthoseobjects一群資料物件與再這物件上被預先定義運算集合3PrimitiveDataTypesAlmostallprogramminglanguagesprovideasetofprimitivedatatypesPrimitivedatatypesThosenotdefinedintermsofotherdatatypes沒有被定義再其他的資料型態中Someprimitivedatatypesarem
3、erely(只是)reflections(反映)ofthehardwareIntegertypeOthersrequire(需要)onlyalittlenon-hardware4IntegerThemostcommonprivativenumeric(數字的)datatypeisintegerJava’ssignedintegersizesbyte,short,int,longC++andC#includeunsignedintegertypesUnsignedtypesareoftenusedforbinarydata5FloatingPoin
4、tModelrealnumbers,butonlyasapproximations(近似值)Languagesforscientific(科學)usesupportatleasttwofloating-pointtypesFloatanddoubleIEEEFloating-PointStandard7546IEEEStandard754Floating-Point(單精確度)(倍精確度、雙精確度)7Decimal(10進位)Forbusinessapplications(money)Essential(基本)toCOBOLC#offersade
5、cimaldatatypeStoreafixednumberofdecimaldigitsAdvantageAccuracy(準確)DisadvantagesLimitedrange(有限的範圍)Wastesmemory(消耗記憶體)8BooleanSimplest(最簡單)ofallRangeofvalues:twoelementsTrueFalseCouldbeimplementedasbits,butoftenasbytesAdvantageReadability9Character(字元)Storedasnumeric(數值)coding
6、sMostcommonlyusedcoding:ASCIIAnalternative,16-bitcoding:UnicodeIncludescharactersfrommostnaturallanguagesOriginallyusedinJavaC#andJavaScriptalsosupportUnicode10CharacterStringTypesValuesaresequencesofcharactersDesignissuesShouldstringsbesimplyaspecialkindofcharacterarrayorapr
7、imitivetype?Shouldstringshavestaticordynamiclength?11CharacterStringTypesOperationsTypicaloperationsAssignmentandcopyingComparison(=,>,etc.)Catenation(串接)Substringreference(子字串參考)Patternmatching(樣式匹配)12CharacterStringTypeinCertainLanguagesCandC++Notprimitive(基本)Usechararraysa
8、ndalibraryoffunctionsthatprovideoperationsJavaPrimitiveviatheStringc
此文档下载收益归作者所有