« Home « Chủ đề thủ thuật lập trình C

Chủ đề : thủ thuật lập trình C


Có 40+ tài liệu thuộc chủ đề "thủ thuật lập trình C"

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

tailieu.vn

Từ nhiều năm nay chúng ta đã nghe nhiều đến thuật ngữ “Lập trình hướng đối tượng” (OOP - Object Oriented Programming). Cách viết chương trình như thế này gọi là phương pháp lll. Ngôn ngữ lập trình thể hiện rõ nét nhất phương pháp lập trình cấu trúc chính là Pascal. Tuy nhiên, khi sử dụng phương pháp lập...

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

tailieu.vn

không cần khai báo (khi đó ngầm định giá trị trả về của hàm là int) 4. các tham số.. khai báo hàm nguyên mẫu.. Bên cạnh đó, C++ còn cài đặt thêm các khả năng vào/ra mới dựa trên hai toán tử “<<”(xuất) và “>>” (nhập) với các đặc tính sau đây:. tương ứng với hai thiết bị chuẩn...

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

tailieu.vn

<khai báo các thành phần riêng trong từng đối tượng>. <khai báo các thành phần công cộng của từng đối tượng>. <định nghiã của các hàm thành phần chưa được định nghĩa bên trong khai báo lớp>. /*khai báo các thành phần dữ liệu riêng*/. /*khai báo các hàm thành phần công cộng*/. /*định nghĩa các hàm thành phần bên...

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

tailieu.vn

cout<<real<<(image> lt;<"j*"<<fabs(image)<<endl . cout<<"Hai so phuc:\n";. cout<<"Tong hai so phuc:\n";. cout<<”Goi toi complex::operator+(float, complex)\n”;. cout<<”Goi toi operator+(float, complex)\n”;. cout<<"a = ";. cout<<"b = ";. cout<<"c = ";. cout<<"Tang them phan thuc cua a 3 don vi\n";. cout<<"d = ";. cout<<"Tao doi tuong :"<<this<<endl;. cout<<"Goi toi complex::operator+(complex)\n";. cout<<this<<endl;. cout<<"Goi toi operator+(float, complex)\n";. cout<<"so phuc a \n";. cout<<"so phuc b \n";. cout<<"Cong...

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

tailieu.vn

đối tượng. cout<<"Goi ham point::display() \n";. cout<<"Toa do :"<<x<<". "<<y<<endl;. cout<<"Ham coloredpoint::display()\n";. cout<<"Mau "<<color<<endl;. cout<<"Diem m \n";. cout<<"Chi hien thi toa do cua m\n";. cout<<"Diem n \n";. cout<<"Chi hien thi toa do cua n\n";. cout<<"Diem p \n";. cout<<"Chi hien thi toa do cua p\n";. cout<<"adp = &pc \n";. cout<<"adp->move(2,3)\n";. cout<<"point &rp = pc \n";. cout<<"rp.move(2,3)\n";. <<". cout<<"pc = ";. cout<<"coloredpoint...

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

tailieu.vn

Hiểu được lợi ích của việc sử dụng khuôn hình hàm và khuôn hình lớp để viết chương trình.. Biết cách tạo và sử dụng một khuôn hình hàm và khuôn hình lớp.. Khái niệm các tham số kiểu và các tham số biểu thức trong khuôn hình hàm, khuôn hình lớp.. Định nghĩa chồng khuôn hình hàm.. Cụ thể...

Bài tập học Lập trình C

tailieu.vn

cout<<"---\n";. cout<<"Nhap N=". <<setw(17)<<setprecision(2)<<setiosflags(ios::showpoint | ios::fixed). <<kq. cout<< lt;<endl;. //Neu 0<X<=2 thi F(x)=x*x-x. cout<<setiosflags(ios::showpoint|ios::fixed);. cout<<setprecision(2);. cout<<"tien dien: ". <<setprecision(0). cout<<"Nhap % tang K=". cout<<"\n---";. cout<<"\n---\n";. cout<<"\nNhap mang\n";. cout<<"Nhap N=";. cout<<setw(10)<<s[i];. cout <<. <<. i <<. i++)cout <<. a[i] <<. cout<<a[i]<<". cout<<endl;. "<<setw(10)<<b[i];. 0 cout<<". //vong lap i=2->n cout<<". max <<. //in ket qua cout <<. min <<. a[0] <<. a[n-1]...

Giáo trình lập hướng đối tượng

tailieu.vn

5: cout<<. 7: cout<<. 8: cout<<. 9: cout<<. <<"\n". 6: cout<<. 6: cout <<. 7: <<. BoxVolume() <<. endl <<. 8: <<. 9: <<. BoxVolume(10) <<. 10: <<. 11: <<. BoxVolume(10, 5) <<. 12: <<. 13: <<. BoxVolume(10, 5, 2)<<. <<. <<=. 22: cout <<. 24: cout <<. 26: cout <<. 10: cout <<. lt;<. Hour <<. Minute <<. 9:...

Manning Windows Forms Programming (phần 1)

tailieu.vn

1 Getting started with Windows Forms 3 2 Getting started with Visual Studio .NET 34. 9 Basic controls 263 10 List controls 314 11 More controls 353 12 A .NET assortment 383 13 Toolbars and tips 410. 18 Odds and ends .NET 603. about this book xxi acknowledgments xxviii about .NET xxx. 2 Getting started with Visual Studio .NET 34....

Manning Windows Forms Programming (phần 2)

tailieu.vn

The compiler uses the correct System.Windows.Forms.But- ton class because of the using keyword, and because the System.Web namespace is not referenced by our program.. Let’s go back to our use of the Button and PictureBox classes. Note the use of the new keyword to initialize our two fields. So typing Alt+L in the application will simulate a click of the...

Manning Windows Forms Programming (phần 3)

tailieu.vn

and to summarize what is displayed in the main window. Chapter 9 on “Basic controls” begins a systematic review of the standard Windows Forms controls available in the .NET Framework. The View menu is exposed, and a submenu of the Image menu item is displayed as well.. of the mouse. Note that context menu items can also contain submenus similar...

Manning Windows Forms Programming (phần 4)

tailieu.vn

S ET THE TEXT TO APPEAR IN THE PANELS. 1 In the menuLoad_Click method, set the ShowPanels property to false while the image is loading.. In the code shown here, the "{0. S ET THE TEXT TO APPEAR IN THE PANELS (continued). The StatusBar class uses a derived version of this class, but the bulk of the drawing information is...

Manning Windows Forms Programming (phần 5)

tailieu.vn

4 Create an empty album at the end of the MainForm constructor.. Set the version number of the MyPhotos application to 6.2.. Multiselect Gets or sets whether the user can select multiple files in the dialog. As we have seen before, a graphic of the current layout for this form is displayed.. A new menuAdd_Click method is added to and...

Manning Windows Forms Programming (phần 6)

tailieu.vn

Since the Form object managed the scrolling, the StatusBar control on the form was caught up in the scroll- ing logic. In the source code, the panel is added using the Control property of the parent form. A private instance is created in the MainForm class, initialized in the Initialize- Component method, and added to the form using the Form.Controls...

Manning Windows Forms Programming (phần 7)

tailieu.vn

Later in this section we will cre- ate some infrastructure that will be useful in our derived forms later in the chapter.. The new class appears in the Solution Explorer window and the BaseEditDlg.cs [Design]. This is not an actual property in the C# sense, and does not appear in the documentation for the Button class. There are five possible...

Manning Windows Forms Programming (phần 8)

tailieu.vn

DisplayMember Gets or sets the property to use when displaying objects in the list control. SelectedIndex Gets or sets the zero-based index of the object selected in the control.. SelectedValue Gets or sets the value of the object selected in the control.. ValueMember Gets or sets the property to use when retrieving the value of an item in the list...

Manning Windows Forms Programming (phần 9)

tailieu.vn

We will add a second TabPage later in the chapter to display the set of dates asso- ciated with the album in a calendar format. In the .NET Framework, this support extends to Windows Forms controls as well.. Use the Events listing in the Properties window, and select the existing methods from the appropriate dropdown lists.. The dropdown calendar is...

Manning Windows Forms Programming (phần 10)

tailieu.vn

Typically, this class is used to support one or more Windows Forms controls in the management and display of images within the control. ColorDepth Gets or sets the color depth for images in the list.. ImageSize Gets or sets the size for images in the list.. TransparentColor Gets or sets the color to treat as transparent in the list’s images.....

Manning Windows Forms Programming (phần 11)

tailieu.vn

of the method.. For our purposes the use of a simple string value in the Tag property was sufficient to display the album’s properties dialog. In the BeginLabelEdit event handler we would make sure the album is valid and can be successfully opened. The code changes required are given in the following steps:. 1 In the MainForm.cs [Design]. Item labels...

Manning Windows Forms Programming (phần 12)

tailieu.vn

1 Set the LabelEdit property for the TreeView control to true in the MainForm.cs [Design]. 2 Handle the KeyDown event for the TreeView control to initiate a label edit when the F2 key is pressed in the tree control.. Also of note is our use of the FindNode method created earlier in the chapter as part of section 15.4.2. 1...