7. The third C programFirst, take a look at the following small program and try to compile and run it by yourself. If you do not know how to compile, click the following hyperlink:Compiler usageCompiler Dev-C ++ download tutorial
/* Circle. c -- calculate the area of the circle */
# IncludeStdio. h>
Int main (void){Fl
C # enumeration (enum)
An enumeration is a set of named integer constants. Enumeration types are declared using the enum keyword.
C # Enumerations are value data types. In other words, the enumeration contains its own values and cannot inherit or pass inheritance.
Declaring an enum variable
General syntax for declaring enumerations:
Enum
which
ENUM_NAME Specifies the type name of the enumeration.
The enume
explained the conditional operators in the previous chapters. : Can be used instead of if...else statements. Its general form is as follows:
Exp1? EXP2:EXP3;
Among them, EXP1, EXP2, and Exp3 are expressions. Notice the use and position of the colon.
? The value of an expression is determined by EXP1. If EXP1 is true, the value of EXP2 is computed and the result is the whole? The value of an expression. If EXP1 is false, the value of EXP3 is computed and the result is the whole? The value of
Public classMrzhang {//In fact, the sad figure of buying a ticket is Xiao Zhang Public Static voidBuyticket () {Console.WriteLine ("NND, let me go to buy tickets every time, chicken man! "); } Public Static voidBuymovieticket () {Console.WriteLine ("I'll go, pick up the girls, and let me bring the movie tickets! "); } } //Xiao Ming class classmrming {//declaring a delegate is, in fact, a "command." Public Delegate voidBugticketeventhandler (); Public Static
range of Int. Then, for the second printf, regardless of whether we use%HD or%d, the output results are the same. This is because the c language standard stipulates that when the short type value is passed to the function, it is automatically converted to the int type value. It is converted to int because int is designed to be the most efficient integer type of computer processing. So, for computers with a short and int size, converting the variabl
status); The event Boilerloghandler Boilereventlog is defined based on the delegate above; public void Logprocess () {String remarks = "O. K"; Boiler B = new boiler (100, 12); int t = b.gettemp (); int p = b.getpressure (); if (T > | | | t
When the above code is compiled and executed, it produces the following results:
Logging info:temperature 100Pressure 12message:o. K
The above is the "C #
anonymous method or a naming method, that is, passing method parameters to the delegate object.
For example:
nc(10);
Instance
The following example demonstrates the concept of an anonymous method:
Using System; delegate void NumberChanger (int n); namespace DelegateAppl {class TestDelegate {static int num = 10; public static void AddNum (int p) {num + = p; Console. writeLine ("Named Method: {0}", num);} public static void MultNum (int q) {num * = q; Console. writeLine ("Named Method: {0}", num)
[Study Notes-Objective-C] Chapter 10 object initialization and objectivec initialization in Objective-C-Basic tutorial 2nd10.1 allocate objects
When an alloc message is sent to a class, a large enough memory can be allocated for the class to store all instance variables of the class. At the same time, alloc initializes all the memory areas to 0.
The newly allocat
Object-C Development tutorial -- MRC and ARC hybrid editing, object-c -- mrc
After iOS5.0, you can use ARC (Automatic Reference Counting: Automatic Reference count) to replace the previous MRC (Manual Reference Counting: Manual Reference count ). Using ARC reduces the trouble of code and forgetting to release objects. But everything has two sides. If you want to
C # ADO database accessWhat I want to talk about in this section is something that everyone cares about and is certainly very interested in. hey hey, it's also the best part of my tutorial-ADO database access. this reminds me of the "database access" series I wrote last year! So, if you think it is hard to understand the record set or something like that, I recommend you read my articles first. Well, let's
"translated" C # tutorials and source code
"translated" Microsoft C # Overview: Introduction to C #
"translated" Microsoft C # Overview: C # and VB.net
"translated" Microsoft C # Overview:
C # ASP. NET, hacker technology, web design, tutorial download
Tutorial video search Daquan (Millions of free video download, no need to install plug-ins, right-click Select Download tool download can be): http://www.verycd.com/
30 C #. netpdf book download http://www.isoho.net/down/view.asp? Id = 12
Lang Xi video
Update
Everybody visit http://www.lwxshow.com/archives/397
You can see an update from.
Click the following link to download the corresponding video tutorial.
Idle is also idle.
I will share with you a video tutorial on iOS development.
Objective-C video program download
A powerful reply to the need for fast download by thunder.
Vide
Below are all the complete tutorials for C languageC Language Tutorial (i): The theoretical basis of program developmentC Language Tutorial (ii): Development Environment ConstructionC Language Tutorial (iii): binary and binary conversionsC Language Tutorial (iv): Constants,
Sun Xin C ++ video tutorial rmvb full 20cd full version
Http://bbs.topsage.com/dispbbs.asp? Boardid = 121 id = 156290
C ++ video tutorial: Learn visual c ++ 6 (asfformat)
Http://bbs.topsage.com/dispbbs.asp? Boardid = 121 id = 177500
Sun Yat-sen University Cai peixing
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.