资源描述:
《计算机导论-讲稿2.ppt》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库。
1、DataRepresentationChapter2天津大学软件学院2.1DATATYPES(数据类型)Datatodaycomeindifferentformssuchasnumbers,text,images,audio,andvideo.Peopleneedtoprocessallthesedatatypes.Thecomputerindustryusestheterm“multimedia”todefineinformationthatcontainsnumbers,text,imag
2、es,audio,andvideo.number:数值text:文本image:图像audio:音频Video:视频Multimedia:多媒体AnalogandDigital(模拟和数字)InformationComputersarefinite(有限的).Computermemoryandotherhardware(硬件)deviceshaveonlysomuchroomtostoreandmanipulateacertainamountofdata.Thegoalofdatareprese
3、ntation(数据表示)istorepresentenoughoftheworldtosatisfyourcomputationalneedsandoursensesofsightandsound.AnalogandDigitalInformationInformationcanberepresentedinoneoftwoways:analogordigital.AnalogdataAcontinuousrepresentation,analogoustotheactualinformati
4、onitrepresents.DigitaldataAdiscreterepresentation,breakingtheinformationupintoseparateelements.AnalogandDigitalInformationAmercurythermometerexemplifiesanalogdataasitcontinuallyrisesandfallsindirectproportiontothetemperature.Digitaldisplaysonlyshowdi
5、screte(离散的)information.2.2DATAINSIDETHECOMPUTERAlldatatypesfromoutsideacomputeraretransformedintoauniformrepresentationwhenstoredinacomputerandthentransformedbackwhenleavingthecomputer.Thisuniversalformatiscalledabitpattern(位组合格式).BIT(位)Abit(binarydi
6、git)isthesmallestunitofdatathatcanbestoredinacomputer;itiseither0or1.BITPATTERN(位组合格式)Abitpatternisasequence,orasitissometimescalled,astringofbitsthatcanrepresentasymbol.e.g.BYTE(字节)Abitpatternoflength8iscalledabyte.Examplesofbitpatterns2.3REPRESENTI
7、NGDATATEXT(文本)Apieceoftextinanylanguageisasequenceofsymbolsusedtorepresentanideainthatlanguage.Youcanrepresenteachsymbolwithabitpattern.Inotherwords,textsuchas“BYTE”,whichismadeoffoursymbols,canberepresentedas4bitpatterns,eachpatterndefiningasinglesy
8、mbol.Howmanybitsareneededinabitpatterntorepresentasymbolinalanguage?Thelengthofthebitpatternthatrepresentsasymbolinalanguagedependsonthenumberofsymbolsusedinthatlanguage.Moresymbolsmeanalongerbitpattern.Therelationshipisnotlinear;itislogarithmic.Ifyo