1. General Bubble Sort1 //Bubble Sort2#include 3 intMain () {4 inta[Ten],i,j,t;5printf"Enter numbers:"); 6 for(i=0;iTen; i++){7scanf"%d",a[i]);8 }9 //The number of n in the array, and then the n-1 of the larger number, so the loop of the outer loop is n-1Ten for(i=0;i9; i++){ One //for each round of comparisons, a total of J comparisons were performed, with J starting from 0 cycles, and the No. 0 cycle (n-1)-0 times; A //
stderr_fileno,in my case, I wantto redirect the output to a file, so the fol lowing command is used:
Time./the_program_to_be_tested > Result 2>1
3How to pass parameters to a function?Suppose the following code section:1:Time_xtar_load()2:{3: Time./Xtar_load $4:}5:6: for ((I= 0;I$num _process;I++))7: Do8: Time_xtar_load $i9:DoneIn this example, a function named Time_xtar_load are defined, and the "for" sta
One or one-D arrays①, define the wayType specifier array name [constant expression];such as: int array[10];Attention:1) The type of the array is actually the type of the exponent group element. For the same array, all of its elements have the same data type.2) The writing rules of the array name shall conform to the written provisions of the identifiers.3) The array name cannot be the same as other variable names.4) The constant expression in square brackets represents the number of array elemen
absolute value of the difference above the I layer and below the I layer is increased, and the BLOWC+EQULC is reduced by BLOWC-EQULC. Find out the total number of stairs climbed in each floor, and choose the least stop. Second, the program code1#include"stdafx.h"2#include 3#include"stdlib.h"4 #defineMax 10005 voidFloornum (int*inch,intnum)6 {7 intresult[max]={0};8 intBLOWC,EQULC,HIGHC;//indicate less than, equal to, and greater than number of I9
+ + + compilers, function arguments are in the stack from right to left and then local variables in the function. Note: Static variables are not as good as stacks. This time the function is adjustedAfter the end, the local variable first out of the stack, and then the function parameters, the last stack pointer to the first stored in the main function of the next instruction address, the program from the point followingContinuous operation.Iii. Examples of interpretationGlobal initialization Zo
1. Introduction method2. Case-sensitiveJavaScript language is strictly case-sensitive name name3. How to AnnotateComment Line/*Comment Multiple lines*/4. The end of the disposition number can be omitted (multiple expressions written in one line cannot be omitted)var name= "Tom";var age = 23;5. Variable naming rulesName composition: Letters, numbers, underscores, $The first character of the start cannot be a number.var $ = "China"; Yes, the jquery frameworkvar 9 = "Hello"; No6. Global variables a
#批量修改当前目录下的文件扩展名, change. doc to. txt1. [email protected] rendir]# vim. /renfilex.sh2. #!/bin/bash3. For FILE in "$"4. Do5. mv $FILE ${file%$1} "$"6. Done++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++Write a sumx.sh script , read a positive integer x from the keyboard, and ask from 1 to x1. [email protected] ~]# vim sumx.sh2. #!/bin/bash3. read-p " Please enter a positive integer: "x4. X=${x:-1}5. I=1; Sum=06. While [$i-le $x]7. Do8. L
; } printf ("fact=%f\n", fact); return 0;}Five-pointer programming01 The meaning of the pointer variable: A pointer variable is a type of variable that accesses the address of another variable or function.02 Definition of pointer variable:Base type * pointer variable name "= initial value"03 Assignment of the pointer variable:* With the address operator assignment, you can assign the address of a variable to a pointer variable.such as: float f,*p;p=f;* Define the simultaneous assignment of poin
Second, file-level operations1. View File Size: Ls-lah2. View the number of files: Wc-l file name3. Forcibly Delete folder: Rm-r folder4. View file full path: pwd5. View file Size: ll file path-h or ls-l file path-H6. Take the first few lines of a file: head-n number of rows file name7. Find content in File: Sed-n '/What to look for '/p filename | Wc-l8. Connect two files together as the first columnCases:Awk-f ' \ t ' {for (i=2;i9. Remove the second
Original chain: http://www.cnblogs.com/vamei/archive/2012/07/09/2582435.htmlNote: Zip () is inconsistent in Python2 3#15th talk cycle design#loops in front are learning, simple loops forIinchRange (10): Print(i**2)#It's a very simple loop.#Range ()s='Abcdefghijk' forIinchRange (0, Len (s), 2):#starting with subscript 0, the number of elements returned by the Len () function, and step Step 2 Print(S[i])#output Result: A C e g i k#Step step This concept is a concept that was introduced befor
method of jquery.4. Use JavaScript to achieve the same effectvar obj = document.getelementsbytagname ("li") [2];console.log (obj); 5.--eq method for jquery objects when selecting child elementsvar $obj = $ ("li"). EQ (0); Console.log ($obj); Console.log ($obj. html ()); Raspberry"description"Using the EQ method to get the jquery object, the HTML content of this object needs to use the jquery HTML () method instead of the innerHTML property of the JavaScript.6. Use j
maintain the distance from each node to the parent node during compression d[i], and update when merging.Code:1#include 2#include string.h>3#include 4#include 5#include 6#include 7 8 #defineRep (i,a,b) for (i= (a); i9 #defineCLR (x, y) memset (x,y,sizeof (×))Ten #defineSQR (x) (x*x) One A intI,j,n, -father[20003],d[20003]; - the voidPre () - { -CLR (father,0); -CLR (d,0); + } - + intFindintx) A { at intr,k,p,sum=0; - - -k=x; - w
=(int) Math.sqrt (x*x+1); Math.sqrt (); Take a number of root System. out. println ("the value of y is:"+y); } }}6.5 inverse of array elements 5. Array elements in reverse order Public classTotal1 { Public Static voidMain (string[] args) {int[] arr={1,2,3,4,5}; intstart=0, end=arr.length-1; for(intj =0; J ) { intTMP =Arr[start]; Arr[start]=Arr[end]; Arr[end]=tmp; Start++; End--; if(start>end) { Break; } } for(intj =0; J ) {System.
1 PackageCom.xunhuan;2 3 Public classZuoYe003 {4 5 6 Public Static voidMain (string[] args) {7 8 for(inti = 1; i//Enter for Loop, (I=1 i9 if(i%3==0i%5==0) {//If judgment I take 3 no remainder, and I take more than 5 no remainder into if, the output is a multiple of 3 and 5TenSystem.out.println ("Filpflop"); One}Else if(i%3==0) {//does not satisfy if enter else if,i take-out 3==0, multiples of output 3 ASystem.out.println ("
var fnum5=parasefloat ("0908"); Returns 908
var fnum6=parasefloat ("Blue"); Returns NaN
3. Force type Conversion
The mandatory type conversions available in ECMAScript are as follows:
Boolean (value)--converts a given value to a Boolean
Number (value)-Converts a given value to a digit (can be an integer or float)
String (value)--converts a given value to a string
Example:
Copy Code code as follows:
var B1=boolean (""); False-empty string
var b2=boolean ("Hi"); True
the young rabbit into a small rabbit, the rabbit 1 months later into a rabbit and gave birth to a pair of young rabbits, asked 8 months after how many pairs of rabbits, rabbits, rabbits, Cheng logarithm of how much respectively.Bunny 1 Bunny 0 Rabbit 0 Initial valueBunny 0 Bunny 10% Rabbit 0 first MonthBunny 1 Bunny 0 Rabbit 1 second monthBunny 1 Bunny 10% Rabbit 1 third MonthBunny 2 Bunny 10% Rabbit 2 fourth MonthBunny 3 Bunny 20% Rabbit 3 fifth monthBunny 5 Bunny 30% Rabbit 5 sixth monthCurre
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.