0
  1. Trang chủ >
  2. Công Nghệ Thông Tin >
  3. Kỹ thuật lập trình >

NET Domain-Driven Design with C#P roblem – Design – Solution phần 4 doc

NET Domain-Driven Design with C#P roblem – Design – Solution phần 1 potx

NET Domain-Driven Design with C#P roblem Design Solution phần 1 potx

... PM3/17/08 2:37:05 PM .NET Domain-Driven Design with C# Problem Design Solution Tim McCarthy Wiley Publishing, Inc.ffirs.indd iiiffirs.indd iii 4/ 14/ 08 10:39 :48 AM4/ 14/ 08 10:39 :48 AMContentsxChapter ... ffirs.indd iiffirs.indd ii 4/ 14/ 08 10:39 :48 AM4/ 14/ 08 10:39 :48 AMflast.indd xviflast.indd xvi 3/17/08 2:57:30 PM3/17/08 2:57:30 PM .NET Domain-Driven Design with C#Acknowledgments xvIntroduction ... 11Summary 11Chapter 2: Designing the Layered Architecture 13The Problem 13The Design 13Designing the Visual Studio Solution 13Designing the Architectural Layers 14 The Solution 18Implementing...
  • 44
  • 374
  • 0
NET Domain-Driven Design with C#P roblem – Design – Solution phần 2 pptx

NET Domain-Driven Design with C#P roblem Design Solution phần 2 pptx

... from the Generic parameter passed in string key = typeof(T).Name;c02.indd 44 c02.indd 44 3/17/08 2:38: 14 PM3/17/08 2:38: 14 PM ... Aggregate, and one for the Employee Aggregate (see Figure 3 .4 ). c03.indd 58c03.indd 58 3/18/08 5:12 :47 PM3/18/08 5:12 :47 PMChapter 2: Designing the Layered Architecture26 The RepositoryMappingCollection ... 20c02.indd 20 3/17/08 2:38:01 PM3/17/08 2:38:01 PMChapter 2: Designing the Layered Architecture 44 Configuration Section Handling Again, just as with the Repository Framework configuration, I have...
  • 43
  • 358
  • 0
NET Domain-Driven Design with C#P roblem – Design – Solution phần 3 docx

NET Domain-Driven Design with C#P roblem Design Solution phần 3 docx

... the GetPrincipals method of the IEmployeeRepository interface. c03.indd 64c03.indd 64 3/18/08 5:12 :49 PM3/18/08 5:12 :49 PMChapter 3: Managing Projects96 { if (this.newProjectNumber != value) ... EntityFactoryBuilder.BuildFactory < T > ();c03.indd 78c03.indd 78 3/18/08 5:12: 54 PM3/18/08 5:12: 54 PMChapter 3: Managing Projects 64 The method first starts out by initializing a Project Number string ... < TextBox Margin=”195,13. 04, 131,0” Visibility=”Hidden” Text=”{Binding Path=NewProjectNumber}” x:Name=”newProjectNumber”/ > c03.indd 104c03.indd 1 04 3/18/08 5:13:03 PM3/18/08 5:13:03...
  • 43
  • 323
  • 0
NET Domain-Driven Design with C#P roblem – Design – Solution phần 4 doc

NET Domain-Driven Design with C#P roblem Design Solution phần 4 doc

... a look at Figure 4. 5 , which shows what the form looks like at run time. Figure 4. 5: The Company Viewc 04. indd 144 c 04. indd 144 3/18/08 5: 14: 24 PM3/18/08 5: 14: 24 PMChapter 4: Companies and Contacts112ProjectClass ... object key = “8b6a05be-6106 -45 fb-b6cc-b03cfa5ab74b”; (continued)c 04. indd 114c 04. indd 1 14 3/18/08 5: 14: 14 PM3/18/08 5: 14: 14 PMChapter 4: Companies and Contacts 141 #region Constructors ... Company > , ICompanyRepository { (continued)c 04. indd 124c 04. indd 1 24 3/18/08 5: 14: 18 PM3/18/08 5: 14: 18 PMChapter 4: Companies and Contacts1 34 Everything is still cleanly broken out and easy...
  • 43
  • 381
  • 0
NET Domain-Driven Design with C#P roblem – Design – Solution phần 5 pptx

NET Domain-Driven Design with C#P roblem Design Solution phần 5 pptx

... class shown previously in this chapter. Figure 4. 6 shows what the form looks like at run time. c 04. indd 154c 04. indd 1 54 3/18/08 5: 14: 28 PM3/18/08 5: 14: 28 PMChapter 5: Submittal Transmittals160SqlCeRepositoryBase<T>GenericAbstractClass ... refactoring going on with the ProjectRepository and the new ViewModel classes. c 04. indd 156c 04. indd 156 3/18/08 5: 14: 29 PM3/18/08 5: 14: 29 PMChapter 4: Companies and Contacts 149 { get { return ... SmartCA.Model.Companies;using SmartCA.Model.Projects;(continued)c 04. indd 149 c 04. indd 149 3/18/08 5: 14: 26 PM3/18/08 5: 14: 26 PMChapter 5: Submittal Transmittals170 The SpecSection Property...
  • 43
  • 269
  • 0
NET Domain-Driven Design with C#P roblem – Design – Solution phần 6 pot

NET Domain-Driven Design with C#P roblem Design Solution phần 6 pot

... FindRfisByProjectTest() { // Get a Project reference Project project = ProjectService.GetProject(“5704f6b9-6ffa -44 4c-9583-35cc 340 fce2a”); // Find all of the RFI’s for the Project IList < RequestForInformation ... AddRfiTest() { // Create a new RequestForInformation Guid projectKey = new Guid(“5704f6b9-6ffa -44 4c-9583-35cc 340 fce2a”); RequestForInformation rfi = new RequestForInformation(projectKey, 2); ... you guessed it, the TransmittalViewModel < T > class. c06.indd 224c06.indd 2 24 3/18/08 5:16: 34 PM3/18/08 5:16: 34 PMChapter 6: Requests for Information 225 The TransmittalViewModel <...
  • 43
  • 430
  • 0
NET Domain-Driven Design with C#P roblem – Design – Solution phần 7 potx

NET Domain-Driven Design with C#P roblem Design Solution phần 7 potx

... 238c07.indd 238 3/18/08 5:17:31 PM3/18/08 5:17:31 PMc07.indd 264c07.indd 2 64 3/18/08 5:17 :40 PM3/18/08 5:17 :40 PMChapter 7: Proposal Requests2 54 The BuildChildCallbacks Method As expected from the ... (continued)c08.indd 274c08.indd 2 74 3/18/08 5:18 :43 PM3/18/08 5:18 :43 PMChapter 7: Proposal Requests235 The relationship to the “ From ” class represents from whom the Proposal Request came, and with which ... Model classes. More behavior will come with this class in the next few sections. (continued)c07.indd 246 c07.indd 246 3/18/08 5:17: 34 PM3/18/08 5:17: 34 PMChapter 7: Proposal Requests260The...
  • 43
  • 282
  • 0
NET Domain-Driven Design with C#P roblem – Design – Solution phần 8 pps

NET Domain-Driven Design with C#P roblem Design Solution phần 8 pps

... this.brokenRuleMessages.GetRuleDescription(messageKey))); } #endregion c08.indd 281c08.indd 281 3/18/08 5:18 :46 PM3/18/08 5:18 :46 PMChapter 9: Construction Change Directives 297 Designing the Construction Change Directive Aggregate The ... in hand with the DescriptionSpecification < TCandidate > class, and I will cover both of these later in the chapter. c09.indd 297c09.indd 297 3/18/08 5:56: 04 PM3/18/08 5:56: 04 PMChapter ... Specification class; actually it is a .NET Generic NumberSpecification < TCandidate > class. c08.indd 278c08.indd 278 3/18/08 5:18 :45 PM3/18/08 5:18 :45 PMChapter 9: Construction Change...
  • 43
  • 286
  • 0
NET Domain-Driven Design with C#P roblem – Design – Solution phần 9 ppt

NET Domain-Driven Design with C#P roblem Design Solution phần 9 ppt

... instance and deserialized into its proper c10.indd 344 c10.indd 344 3/18/08 5:56 :46 PM3/18/08 5:56 :46 PMChapter 10: Synchronizing With the Server 343 builder = new StringBuilder(100); builder.Append(“INSERT ... c10.indd 343 c10.indd 343 3/18/08 5:56 :46 PM3/18/08 5:56 :46 PMChapter 10: Synchronizing With the Server333 The Solution There really are two main parts to the synchronization solution. The ... ClientTransactionService.GetLastSynchronization(); } c10.indd 349 c10.indd 349 3/18/08 5:56 :48 PM3/18/08 5:56 :48 PMChapter 10: Synchronizing With the Server 347 company.PhoneNumber = contract.PhoneNumber;...
  • 43
  • 314
  • 0
Giáo trình C++ - Đại Học Bách Khoa (phần 4) doc

Giáo trình C++ - Đại Học Bách Khoa (phần 4) doc

... >int*int*int*int*đốivớicâulệnhthứhai.CácmởrộngcủaC++-27-a=3;b =4; cout<<"Truockhigoiswap2:\n";cout<<"a="<<a<<"b="<<b<<"\n";swap2(&a,&b);cout<<"Saukhigoiswap2:\n";cout<<"a="<<a<<"b="<<b<<"\n";a=3;b =4; cout<<"Truockhigoiswap3:\n";cout<<"a="<<a<<"b="<<b<<"\n";swap3(a,b);cout<<"Saukhigoiswap3:\n";cout<<"a="<<a<<"b="<<b<<"\n";getch();}Truockhigoiswap1:a=3b =4 Saukhigoiswap1:a=3b =4 Truockhigoiswap2a=3b =4 Saukhigoiswap2:a=4b=3Truockhigoiswap3:a=3b =4 Saukhigoiswap3:a=4b=3Trongchơngtrìnhtrên,tatruyềnthamsốa,bchohàmswap1()theothamtrịchonêngiátrịcủachúngkhôngthayđổitrớcvàsaukhigọihàm.Giảiphápđaratronghàmswap2()làthayvìtruyềntrựctiếpgiátrịhaibiếnavàbngờitatruyềnđịachỉcủachúngrồithôngquacácđịachỉnàyđểxácđịnhgiátrịbiến.Bằngcáchđógiátrịcủahaibiếnavàbsẽhoánđổichonhausaulờigọihàm.Khácvớiswap2(),hàmswap3()đaragiảiphápsửdụngthamchiếu.Cácthamsốhìnhthứccủahàmswap3()bâygiờlàcácthamchiếuđếncácthamsốthựcđợctruyềnchohàm.Nhờvậymàgiátrịcủahaithamsốthựcavàbcóthểhoánđổiđợcchonhau.CácmởrộngcủaC++-20-3.23.23.23.2KhaiKhaiKhaiKhaibbbbááááoooommmmọọọọiiiinnnnơơơơiiiiTrongC++khôngnhấtthiếtphảinhómlênđầucáckhaibáođặtbêntrongmộthàmhaymộtkhốilệnh,màcóthểđặtxenkẽvớicáclệnhxửlý.Vídụ.{intn;n=23;cout<<n<<"\n"; ... >(voidvoidvoidvoid*).Xétvídụsauđây:VVVVííííddddụụụụ2 .4 2 .4 2 .4 2 .4 #include<iostream.h>voidvoidmain(){intn=25;longp=250000;unsignedq=63000;charc='a';floatx=12. 345 6789;doubley=12. 345 6789e16;char*ch="WelcomeC++";int*ad=&n;cout<<"Valueofn:"<<n<<"\n";cout<<"Valueofp:"<<p<<"\n";cout<<"Valueofc:"<<c<<"\n";cout<<"Valueofq:"<<q<<"\n";cout<<"Valueofx:"<<x<<"\n";cout<<"Valueofy:"<<y<<"\n";cout<<"Valueofch:"<<ch<<"\n";cout<<"Addreseofn:"<<ad<<"\n";cout<<"Addresedech:"<<(void*)ch<<"\n";}Valueofn:25Valueofp:250000Valueofc:aValueofq:63000Valueofx:12. 345 679Valueofy:1.2 345 67e+17Valueofch:WelcomeC++Addreseofn:0xfff2Addresedech:0x00b2CácmởrộngcủaC++-29-int&fr(int*d,inti);voidmain(){clrscr();cout<<"Nhapgiatrichomanga:\n";for(inti=0;i<5;i++){cout<<"a["<<i<<"]=";cin>>fr(a,i);}cout<<"Mangasaukhinhap\n";for(i=0;i<5;i++)cout<<a[i]<<"";cout<<"\n";getch();}int&fr(int*d,inti){returnd[i];}Nhapgiatrichomanga:a[0]=6a[1] =4 a[2]=3a[3]=5a [4] =6Mangasaukhinhap 643 56BạnđọccóthểxemthêmphầnĐịnhnghĩachồngtoántửđểthấyđợclợiíchcủavấnđềtrảvềthamchiếuchohàm.6.6.6.6.ĐịĐịĐịĐịnhnhnhnhnghnghnghnghĩĩĩĩaaaachchchchồồồồngngngnghhhhààààmmmm((((OverloadingOverloadingOverloadingOverloadingfunctionsfunctionsfunctionsfunctions))))C++chophépsửdụngmộttênchonhiềuhàmkhácnhautagọiđólàsựchồnghàm.Trongtrờnghợpđó,cáchàmsẽkhácnhauởgiátrịtrảvềvàdanhsáchkiểucácthamsố.Chẳnghạnchúngtamuốnđịnhnghĩacáchàmtrảvềsốnhỏnhấttrong:CácmởrộngcủaC++-33-khaibáoint=12chỉrarằngtrongtrờnghợpvắngmặtthamsốthứhaiởlờigọihàmfct()thìthamsốhìnhthứctơngứngsẽđợcgángiátrịngầmđịnh12.Lờigọifct();khôngđợcchấpnhậnbởivìkhôngcógiátrịngầmđịnhchothamsốthứnhất.VVVVííííddddụụụụ2. 14 2. 14 2. 14 2. 14 #include<iostream.h>voidmain(){intn=10,p=20;voidfct(int=0,int=12);//khaibáohàmvớihaithamsốcógiátrịngầmđịnhfct(n,p);//lờigọithôngthờng,cóhaithamsốfct(n);//lờigọichỉvớimộtthamsốfct();//fct()đÃđợcchấpnhận}voidfct(inta,intb)//khaibáobìnhthờng{cout<<"thamsothunhat:"<<a<<"\n";cout<<"thamsothuhai:"<<b<<"\n";}thamsothunhat:10thamsothuhai:20thamsothunhat:10thamsothuhai:12thamsothunhat:0thamsothuhai:12ChChChChúúúúýýýý18.Cácthamsốvớigiátrịngầmđịnhphảiđợcđặtởcuốitrongdanhsáchcácthamsốcủahàmđểtránhnhầmlẫncácgiátrị.19.Cácgiátrịngầmđịnhcủathamsốđợckhaibáokhisửdụngchứkhôngphảitrongphầnđịnhnghĩahàm.Vídụsauđâygâyralỗibiêndịch:C¸cmëréngcñaC++-37-deletemat[i];deletemat;}voidNhap(int**mat){inti,j;for(i=0;i<10;i++)for(j=0;j<10;j++){cout<<"Thanhphanthu["<<i<<"]["<<j<<"]=";cin>>mat[i][j];}}voidIn(int**mat){inti,j;for(i=0;i<10;i++){for(j=0;j<10;j++)cout<<mat[i][j]<<"";cout<<"\n";}}VVVVÝÝÝÝddddôôôô2.182.182.182.18Qu¶nlýtrµnbénhíset_new_handler#include<iostream>main(){voidoutof();set_new_handler(&outof);longtaille;int*adr;intnbloc;cout<<"Kichthuoccannhap?";CácmởrộngcủaC++-19-Tathamkhảochơngtrìnhsau:VVVVííííddddụụụụ2.62.62.62.6#include<iostream.h>#include<conio.h>voidmain(){intn;floatx;chart[81];clrscr();do{cout<<"Nhapvaomotsonguyen,motxau,motsothuc:";cin>>n>>t>>x;cout<<"Danhap"<<n<<","<<t<<"va"<<x<<"\n";}while(n);}Nhapvaomotsonguyen,motxau,motsothuc:3long3 .4 Danhap3,longva3 .4 Nhapvaomotsonguyen,motxau,motsothuc:5hung5.6Danhap5,hungand5.6Nhapvaomotsonguyen,motxau,motsothuc: 04 3Danhap0,4va33.3.3.3.NhNhNhNhữữữữngngngngtitititiệệệệnnnnííííchchchchchochochochongngngngờờờờiiiillllậậậậpppptrtrtrtrììììnhnhnhnh3.13.13.13.1ChChChChúúúúththththííííchchchchcucucucuốốốốiiiiddddòòòòngngngngMọikýhiệuđisau//chođếnhếtdòngđợccoilàchúthích,đợcchơngtrìnhdịchbỏquakhibiêndịchchơngtrình.Xétvídụsau:cout<<"Xinchao\n";//lờichàohỏiThờngtasửdụngchúthíchcuốidòngkhimuốngiảithíchýnghĩacủamộtcâulệnhgìđó.Đốivớimộtđoạnchơngtrìnhkiểuchúthíchgiớihạnbởi/*và*/chophépmôtảđợcnhiềuthôngtinhơn.CácmởrộngcủaC++-23-square(3)sẽgâylỗibiêndịchvìtakhôngthểthựchiệncácphéptoántănggiảmtrêncáctoánhạnglàhằngsố.Việcsửdụnghàminlineinlineinlineinlinenhmộtgiảiphápthaythếsẽtránhđợccáctìnhhuốngnhthế.Ngoàira,cáchàminlineinlineinlineinlinecóthểđợctốiubởichơngtrìnhbiêndịch.Điềuquantrọnglàđặctảinlineinlineinlineinlinechỉlàmộtyêucầu,chứkhôngphảilàmộtchỉthịđốivớitrìnhbiêndịch.Nếuvìmộtlýdonàođótrìnhbiêndịchkhôngthểđápứngđợcyêucầu(chẳnghạnkhibêntrongđịnhnghĩahàminlineinlineinlineinlinecócáccấutrúclặp)thìhàmsẽđợcbiêndịchnhmộthàmbìnhthờngvàyêucầuinlineinlineinlineinlinesẽbịbỏqua.Hàminlineinlineinlineinlinephảiđợckhaibáobêntrongtệptinnguồnchứacáchàmsửdụngnó.Khôngthểdịchtáchbiệtcáchàminlineinlineinlineinline.15.5.5.5.ThamThamThamThamchichichichiếếếếuuuuNgônngữC++giớithiệumộtkháiniệmmớireferencetạmdịchlàthamchiếu.Vềbảnchất,thamchiếulàbídanhcủamộtvùngnhớđợccấpphátchomộtbiếnnàođó.Mộtthamchiếucóthểlàmộtbiến,thamsốhìnhthứccủahàmhaydùnglàmgiátrịtrảvềcủamộthàm.CácphầntiếpsaulầnlợtgiớithiệucáckhảnăngcủathamchiếuđợcsửdụngtrongchơngtrìnhviếtbằngngônngữC++.5.15.15.15.1ThamThamThamThamchichichichiếếếếuuuuttttớớớớiiiimmmmộộộộttttbibibibiếếếếnnnnXéthaichỉthị:intn;int&p=n;Trongchỉthịthứhai,dấu&đểxácđịnhplàmộtbiếnthamchiếucòndấu=vàtênbiếnnđểxácđịnhvùngnhớmàpthamchiếutới.Lúcnàycảhaiđịnhdanhpvàncùngxácđịnhvùngnhớđợccấpphátchobiếnn.Nhvậycácchỉthịsau:n=3;cout<<p;1Biêndịchtáchbiệtchophépkhaibáohàmtrongmộttệptiêuđề,cònđịnhnghĩahàmđólạiởtrongtậptinchơngtrìnhsửdụnghàm.CácmởrộngcủaC++-21-Trongnhữngtrờnghợpcầnthiết,khimuốntruyxuấttớibiếntoàncụcphảisửdụngtoántử::::::::trớctênbiến:#include<iostream.h>intx;main(){intx=10;//xcụcbộ::x=10;//xtoàncụccout<<x<<\n;//xcụcbộcout<<::x<<\n;//xtoàncục} 4. 4. 4. 4. HHHHààààmmmminlineinlineinlineinlineTrongC++cóthểđịnhnghĩacáchàmđợcthaythếtrựctiếpthànhmÃlệnhmáytạichỗgọi(inline)mỗilầnđợcthamchiếu.ĐiểmnàyrấtgiốngvớicáchhoạtđộngcủacácmacrocóthamsốtrongC.Ưuđiểmcủacáchàminlineinlineinlineinlinelàchúngkhôngđòihỏicácthủtụcbổsungkhigọihàmvàtrảgiátrịvề.Dovậyhàminlineinlineinlineinlineđợcthựchiệnnhanhhơnsovớicáchàmthôngthờng.Mộthàminlineinlineinlineinlineđợcđịnhnghĩavàđợcsửdụnggiốngnhbìnhthờng.Điểmkhácnhauduynhấtlàphảiđặtmôtảinlineinlineinlineinlinetrớckhaibáohàm.Xétvídụsauđây:VVVVííííddddụụụụ2.72.72.72.7#include<iostream.h>#include<math.h>#include<conio.h>inlinedoublenorme(doublevec[3]);//khaibáohàminlinevoidmain(){clrscr();doublev1[3],v2[3];inti;for(i=0;i<3;i++){v1[i]=i;v2[i]=2*i-1;}cout<<"normecuav1:"<<norme(v1)<<"-normecuav2:"<<norme(v2); ... )sẽkếtthúcviệcđọctừcincincincin;kýtựkhônghợplệnàysẽđợcxemxéttronglầnđọcsau.(ii)Đốivớigiátrịxâukýtự,dấuphâncáchcũnglàSPACE,TAB,CR,cònđốivớigiátrịkýtự,dấuphâncáchlàkýtựCR.Tronghaitrờnghợpnàykhôngcókháiniệmkýtựkhônghợplệ.MÃsinhradobấmphímEntercủalầnnhậptrớcvẫnđợcxéttronglầnnhậpxâu/kýtựtiếptheovàdovậysẽcónguycơkhôngnhậpđợcđúnggiátrịmongmuốnkhiđaralệnhnhậpxâukýtựhoặckýtựngaysaucáclệnhnhậpcácgiátrịkhác.Giảiphápkhắcphụcvấnđềnàyđểđảmbảocôngviệcdiễnrađúngtheoýlàtrớcmỗilầngọilệnhnhậpdữliệuchoxâu/kýtựtasửdụngmộttronghaichỉthịsauđây:fflush(stdin);//khaibáotrongstdio.hcin.clear();//hàmthànhphầncủalớpđịnhnghĩađốitợngcinCácmởrộngcủaC++-38-cin>>taille;for(nbloc=1;;nbloc++){adr=newint[taille];cout<<"Capphatblocso:"<<nbloc<<"\n";}}voidoutof()//hàmđợcgọikhithiếubộnhớ{cout<<"Hetbonho-Ketthuc\n";exit(1);}9.9.9.9.TTTTóóóómmmmttttắắắắtttt9.19.19.19.1GhiGhiGhiGhinhnhnhnhớớớớC++làmộtsựmởrộngcủaC(superset),dođócóthểsửdụngmộtchơngtrìnhbiêndịchC++đểdịchvàthựchiệncácchơngtrìnhnguồnviếtbằngC.Cyêucầucácchúthíchnằmgiữa/*và*/.C++cònchophéptạomộtchúthíchbắtđầubằng//chođếnhếtdòng.C++chophépkhaibáokhátuỳý.Thậmchícóthểkhaibáobiếntrongphầnkhởitạocủacâulệnhlặpfor.C++chophéptruyềnthamsốchohàmbằngthamchiếu.ĐiềunàytơngtựnhtruyềnthambiếnchochơngtrìnhcontrongngônngữPASCAL.Tronglờigọihàmtadùngtênbiếnvàbiếnđósẽđợctruyềnchohàmquathamchiếu.Điềuđóchophépthaotáctrựctiếptrênbiếnđợctruyềnchứkhôngphảigiántiếpquabiếntrỏ.ToántửnewnewnewnewvàdeletedeletedeletedeletetrongC++đợcdùngđểquảnlýbộnhớđộngthayvìcáchàmcấpphátđộngcủaC.C++chophépngờiviếtchơngtrìnhmôtảcácgiátrịngầmđịnhchocácthamsốcủahàm,nhờđóhàmcóthểđợcgọivớimộtdanhsáchcácthamsốkhôngđầyđủ.Toántử::::::::chophéptruynhậpbiếntoàncụckhiđồngthờisửdụngbiếncụcbộvàtoàncụctrùngtên.CácmởrộngcủaC++-16-VVVVííííddddụụụụ2.32.32.32.3Sửdụngcoutcoutcoutcoutvà<<đaracácgiátrịkhácnhau:#include<iostream.h>/*phảikhaibáokhimuốnsửdụngcout*/voidmain(){intn=25;cout<<"Value:";cout<<n;}Value:25TrongvídụnàychúngtađÃsửdụngtoántử<<đểinramànhìnhđầutiênlàmộtxâukýtự,sauđólàmộtsốnguyên.Chứcnăngcủatoántử<<rõrànglàkhácnhautronghailầnkếtxuấtdữliệu:vớicâulệnhthứnhất,chỉđaramànhìnhmộtdÃycáckýtự,ởcâulệnhsau,đÃsửdụngmộtkhuônmẫuđểchuyểnđổimộtgiátrịnhịphânthànhmộtchuỗicáckýtựchữsố.ViệcmộttoántửcónhiềuvaitròkhácnhauliênquanđếnmộtkháiniệmmớitrongC++,đólàĐịnhnghĩachồngtoántử.Điềunàysẽđợcđềcậpđếntrongchơng4.VVVVííííddddụụụụ2 .4 2 .4 2 .4 2 .4 Trongvídụnàytagộpcảhaicâulệnhkếtxuấttrongvídụ2.3thànhmộtcâulệnhphứctạphơn,tuykếtquảkhôngkháctrớc:#include<iostream.h>/*phảikhaibáokhimuốnsửdụngcout*/voidmain(){intn=25;cout<<"Value:"<<n;}Value:252.22.22.22.2CCCCáááácccckhkhkhkhảảảảnnnnăăăăngngngngviviviviếếếếttttrarararatrtrtrtrêêêênnnncoutcoutcoutcout....Chúngtavừaxemxétmộtvàivídụviếtmộtxâukýtự,mộtsốnguyên.Mộtcáchtổngquát,chúngtacóthểsửdụngtoántử<<cùngvớicoutcoutcoutcoutđểđaramànhìnhgiátrịcủamộtbiểuthứccócáckiểusau:8.kiểudữliệucơsở(charcharcharchar,intintintint,floatfloatfloatfloat,doubledoubledoubledouble),9.xâukýtự:(charcharcharchar*),10.contrỏ(trừcontrỏcharcharcharchar*)CácmởrộngcủaC++-28-Cómộtvấnđềmàchắcrằngbạnđọcsẽphânvân:làmthếnàođểkhởitạocácthamsốhìnhthứclàthamchiếu.Xintharằngđiềuđóđợcthựchiệntựđộngtrongmỗilờigọihàmchứkhôngphảitrongđịnhnghĩa.Từđónảysinhthêmmộtnhậnxétquantrọng:thamsốứngvớithamsốhìnhthứclàthamchiếuphảilàbiếntrừtrờnghợpcótừkhoáconstđứngtrớckhaibáothamsốhìnhthức.Chẳnghạnkhôngthểthựchiệnlờigọihàmsau:swap3(2,3);BạnđọccóthểxemthêmphầnHàmthiếtlậpsaochéplạiđểthấyđợcíchlợitolớncủaviệctruyềnthamsốchohàmbằngthamchiếu.ChChChChúúúúýýýý:khimuốntruyềnbằngthambiếnmộtbiếntrỏthìviếtnhsau:int*&adr;//adrlàmộtthamchiếutớimộtbiếntrỏchỉđếnmộtbiếnnguyên.5.35.35.35.3GiGiGiGiáááátrtrtrtrịịịịtrtrtrtrảảảảvvvvềềềềccccủủủủaaaahhhhààààmmmmllllààààthamthamthamthamchichichichiếếếếuuuuĐịnhnghĩacủahàmcódạngnhsau:<type>&fct(...
  • 29
  • 758
  • 5

Xem thêm

Từ khóa: circuit design with vhdllogic design with vhdlsystems analysis and design with umldigital logic design book by p rajadigital electronics and logic design by a p godse d a godse pdf free downloaddigital logic design by a p godse d a godse pdfBáo cáo quy trình mua hàng CT CP Công Nghệ NPVchuyên đề điện xoay chiều theo dạngđề thi thử THPTQG 2019 toán THPT chuyên thái bình lần 2 có lời giảiGiáo án Sinh học 11 bài 13: Thực hành phát hiện diệp lục và carôtenôitQuản lý hoạt động học tập của học sinh theo hướng phát triển kỹ năng học tập hợp tác tại các trường phổ thông dân tộc bán trú huyện ba chẽ, tỉnh quảng ninhPhát triển mạng lưới kinh doanh nước sạch tại công ty TNHH một thành viên kinh doanh nước sạch quảng ninhTrả hồ sơ điều tra bổ sung đối với các tội xâm phạm sở hữu có tính chất chiếm đoạt theo pháp luật Tố tụng hình sự Việt Nam từ thực tiễn thành phố Hồ Chí Minh (Luận văn thạc sĩ)Nghiên cứu, xây dựng phần mềm smartscan và ứng dụng trong bảo vệ mạng máy tính chuyên dùngNghiên cứu khả năng đo năng lượng điện bằng hệ thu thập dữ liệu 16 kênh DEWE 5000Quản lý nợ xấu tại Agribank chi nhánh huyện Phù Yên, tỉnh Sơn La (Luận văn thạc sĩ)BT Tieng anh 6 UNIT 2Tăng trưởng tín dụng hộ sản xuất nông nghiệp tại Ngân hàng Nông nghiệp và Phát triển nông thôn Việt Nam chi nhánh tỉnh Bắc Giang (Luận văn thạc sĩ)Giáo án Sinh học 11 bài 15: Tiêu hóa ở động vậtGiáo án Sinh học 11 bài 14: Thực hành phát hiện hô hấp ở thực vậtGiáo án Sinh học 11 bài 14: Thực hành phát hiện hô hấp ở thực vậtGiáo án Sinh học 11 bài 14: Thực hành phát hiện hô hấp ở thực vậtGiáo án Sinh học 11 bài 14: Thực hành phát hiện hô hấp ở thực vậtChiến lược marketing tại ngân hàng Agribank chi nhánh Sài Gòn từ 2013-2015MÔN TRUYỀN THÔNG MARKETING TÍCH HỢPQUẢN LÝ VÀ TÁI CHẾ NHỰA Ở HOA KỲ