C³ÌÐò£ºÊä³ö1,2,3,..,nµÄËùÓÐ×éºÏÊý
/*
˼·£ºµÝ¹éËã·¨
´Ó¿ªÊ¼ÍùºóµÝÔöµØÐ´Êý×Ö£¬µ±Ç°´ÓnowÖµ¿ªÊ¼£¬´æ´¢µÄλÖôÓcur¿ªÊ¼£¬
ÔòÏÔÈ»¼ÓÉÏ£¬now..n£¬¶¼ÊÇеÄ×éºÏÊý£¬¶ÔÓÚÿһ¸ö£¬{ Êä³öÖ®£¬È»ºóµÝ¹é£¬´¦Àí _c(n, cur+1, a, i+1) }
*/
/* Êä³ö1,2,3,..,nµÄ×éºÏÊý */
#include <stdio.h>
#include <assert.h>
#include <malloc.h>
void c(int n)
{
extern void _c(int n, int cur, int *a, int now);
int *a;
a = (int *) malloc(n * sizeof(int));
assert(a != NULL);
_c(n, 0, a, 1);
free(a);
}
void _c(int n, int cur, int *a, int now)
{
int i,j;
for (i=now; i<=n; i++)
{
a[cur] = i;
for (j=0; j<=cur; j++)
{
printf("%d ", a[j]);
}
printf("\n");
_c(n, cur+1, a, i+1);
}
}
int main()
{
c(3);
}
Ïà¹ØÎĵµ£º
1.ÒýÑÔ
¡¡¡¡±¾ÎĵÄд×÷Ä¿µÄ²¢²»ÔÚÓÚÌṩC/C++³ÌÐòÔ±ÇóÖ°ÃæÊÔÖ¸µ¼£¬¶øÖ¼ÔÚ´Ó¼¼ÊõÉÏ·ÖÎöÃæÊÔÌâµÄÄÚº¡£ÎÄÖеĴó¶àÊýÃæÊÔÌâÀ´×Ô¸÷´óÂÛ̳£¬²¿·ÖÊÔÌâ½â´ðÒ²²Î¿¼ÁËÍøÓѵÄÒâ¼û¡£
¡¡¡¡Ðí¶àÃæÊÔÌâ¿´ËÆ¼òµ¥£¬È´ÐèÒªÉîºñµÄ»ù±¾¹¦²ÅÄܸø³öÍêÃÀµÄ½â´ð¡£ÆóÒµÒªÇóÃæÊÔÕßдһ¸ö×î¼òµ¥µÄstrcpyº¯Êý¶¼¿É¿´³öÃæÊÔÕßÔÚ¼¼ÊõÉϾ¿¾¹´ïµ½Á ......
´ó¼ÒºÃ£¬ÕâÀïÓÐIBMµÄÈý¸ö³¤ÆÚÐèÇ󣺾ùÊÇÐèÒª2ÄêÒÔÉÏÏà¹Ø¹¤×÷¾Ñ飬ÆäÖÐJavaÒÔ¼°TestingÐèÒªÓ¢Óï¿ÉÒÔ½»Á÷£¬C/Unix²»ÐèÒªÓïÑÔ¡£
Java ´óÁ¬
ÃèÊö£ºJava programming, knowledge in J2SE, SWT/JFace, XML. Eclipse programming, knowledge in eclipse architecture. Clear understanding of plugin development. Hands-on exp ......
µÚ¶þÕ Õ÷·þ¿É²âÐÔÄÑÌâ
2.1 ¿É²âÐÔÎÊÌâÏê½â£¨1£©
µ¥Ôª²âÊÔÐ§ÒæÌØ±ð¸ß£¬·½·¨Ò²ºÜ¼òµ¥£¬µ«È´³¢ÊÔµÄÆóÒµºÜ¶à£¬³É¹¦ÊµÊ©µÄÆóÒµºÜÉÙ£¬ÎªÊ²Ã´ÄØ£¿Ö÷ÒªÔÒò¾ÍÊÇÄÑÓÚÍ»ÆÆ¿É²âÐÔÎÊÌâ¡£“¿É²â”Õâ¸ö´Ê£¬Òâ˼ÒѾºÜÃ÷°×ÁË£¬Èç¹û²»“¿É²â”µÄ»°£¬ÄǾÍÊDz»Äܲ⣬û·¨²â£¬¾ÍÊÇ× ......
ÓúêʵÏÖÒ»¸öswap¹¦ÄÜ
#include <stdio.h>
#include <stdlib.h>
#define SWAP( TYPE,ARG1,ARG2 ) \
void TYPE##Swap( TYPE *p, TYPE *q ) \
{ \
TYPE tmp = *p; \
*p = *q; \
*q = tmp; \
} \
TYPE##Swap(&ARG1,&ARG2 ......