资源描述:
《地球上最开始有生命吗.ppt》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、C++BasicsProgrammingIntroductiontoC++Cisaprogramminglanguagedevelopedinthe1970swiththeUNIXoperatingsystemCprogramsareefficientandportableacrossdifferenthardwareplatformsC++isanextensionoftheClanguageCprogramsshouldruninC++C++supports“object-oriented”programmingGeneralformofaC++program//Progr
2、amdescriptionisfirst#includedirectivesgonextusingnamespacestd;intmain(){constantdeclarationsgoherevariabledeclarationsgohereassignmentstatementsgoherereturn0;}GeneralformofaC++program//simpleprogram#includeusingnamespacestd;intmain(){//constantdeclarationconstdoublePi=3.14159;//var
3、iabledeclarationsdoubleradius;doublearea;//assignmentstatementscout<<"Entercircleradius:";cin>>radius;area=Pi*radius*radius;cout<<"Area:"<
4、l,break,case,catch,char,class,const,continue,default,delete,do,double,else,enum,extern,float,for,friend,goto,if,include,inline,int,long,namespace,new,operator,private,protected,public,register,return,short,signed,sizeof,static,struct,switch,template,this,throw,try,typedef,union,unsigned,usin
5、g,virtual,void,volatile,whileSyntaxoftheC++LanguageIdentifiers(appearinblackinVisualC++)Anidentifierisanameforvariables,constants,functions,etc.Itconsistsofaletterfollowedbyanysequenceofletters,digitsorunderscoresNamesarecase-sensitive.Thefollowingareuniqueidentifiers:Hello,hello,whoami,whoA
6、MI,WhoAmINamescannothavespecialcharactersintheme.g.,X=Y,J-20,#007,etc.areinvalididentifiers.C++reservedwordscannotbeusedasidentifiers.Chooseidentifiersthataremeaningfulandeasytoremember.SyntaxoftheC++LanguageComments(appearingreeninVisualC++)Commentsareexplanatorynotesnotcompiled(i.e.noexecu
7、tablecodeisgeneratedforcomments)Commentsaredoneintwoways://Adoubleslashstartsasinglelinecomment/*Aslashfollowedbyanasteriskmarksthestartofamultiplelinecomment.Itendswithanasteriskfollowedbyaslash*/SyntaxoftheC++LanguageCompilerDirective:#includeItr