days floatmoney=0, Ave; while(n -) { money=money+0.8*N; Day++; N*=2;//N each x2} Ave=money/Day ;printf ("I'm a jerk, I buy apples every day.") I am Tao Tao I bought%d apples ", N/2);//Because n exits the loop because the n> or =100 is because the number of X is 2 so I have to/2 to get the amount of the Tao to buy apples printf ("The result is%.6f", Ave); return 0;} I'm a jerk. I buy apples every day. I'm Tao Tao, I bought 64 apples.//The result is 16.799999Code for the preparation of level
the array arr, so assigning a value to arr[-1 changes the var_2 value exactly. Different compiler compilation runs the program may have different output, or it may exit unexpectedly. The philosophy of C language is to trust programmers, and not to detect Cross-border programs running faster. When the program compiles, some of the underlying values are still unknown, so if you want to detect the subscript out of bounds, the compiler must add extra co
Ubuntu12.04 use c to compile the php extension module tutorial. The system is ubuntu12.04. apache and php have been installed. The php version is 5.3.10. If you encounter permission problems, we recommend that you switch to root. 1. download the source code and check out the system ubuntu 12.04. apache and php have been installed, and the php version is 5.3.10.
If you encounter permission problems, we reco
Previous ArticleArticleRecords the knowledge of flow control statements in C #. This section describes the pre-processor commands in C, C # Preprocessor commands allow the compiler to do a lot of things that the C # basic syntax cannot do. I have only read this before and have never actually used it. This is just the c
Visual C + + (VC/MFC) learning ebook and development tools download see here
an unprecedented network of the strongest and strongest C + + data indexes:
E-C + + programming language learning Materials Panorama ebook + video Tutorial
VC++/MFC (VC6) Development Technology Quality Learning material
worth noting:
C # is case-sensitive.
All statements and expressions must end with a semicolon (;).
The execution of the program starts with the Main method.
Unlike Java, a file name can be different from the name of a class.
Compiling executing C # programs
If you are using Visual Studio.NET to compile and execute a C # program, follow these steps:
Start Visual
}", num1, num2, num3, num4); Console.WriteLine ("A nullable Boolean value: {0}", boolval); Console.ReadLine ();}}}
When the above code is compiled and executed, it produces the following results:
Displays the value of a nullable type:, 3.14157, a nullable Boolean value:
The Null merge operator (?? )
The null merge operator is used to define the default values for nullable types and reference types. The null merge operator defines a preset value for
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)
(out a, out B); Console.WriteLine ("After the method call, the value of a: {0}", a); Console.WriteLine ("After a method call, the value of B: {0}", b); Console.ReadLine ();}}}
When the above code is compiled and executed, it produces the following results (depending on user input):
Please enter the first value: 7 Enter the second value: 8 after the method call, the value of a: 7 after the method call, the value of B: 8
The above is the "
[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
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.