CС³ÌÐò£¨Ôöɾ¸Ä²éÈ«ÃæÁ·Ï°£©
1.ÅÅÐòС³ÌÐò£ºÁ·Ï°ÅÅÐò»ù±¾Ëã·¨ºÍº¯ÊýµÄÓ¦Ó㬲¢Ìåζº¯ÊýÓ÷¨µÄºÃ´¦¡£
#include "stdio.h"
#include "stdlib.h"
#include "string.h"
#define DATA 10
int ArrGrounp[ DATA ];
int ArrGrounp1[DATA];
#define DEFINE1 "ÇëÊäÈë10¸öÊý£º\n"
#define DEFINE2 "Âú×ãÌõ¼þµÄÊýÓУº"
#define DEFINE3 "\nÂú×ãÌõ¼þµÄÊý´Ó´óµ½Ð¡ÅÅÁÐΪ£º"
void InPut(); //ÊäÈ뺯Êý
void trans(); //ɸѡÂú×ãÌõ¼þµÄÊý×Ö
void printfData(); //ÏÔʾº¯Êý
void sort(); //½«Âú×ãÌõ¼þµÄÊý×é½øÐÐÅÅÐò
void main()
{
InPut();
trans();
printfData();
sort();
}
void InPut()
{
printf(DEFINE1);
for(int i=0;i< DATA ;i++)
{
scanf("%d",ArrGrounp[i]);
}
}
void trans()
{
int a,b,c,d,e,f;
int k=0;
for(int i=0;i< DATA ;i++)
{
a=ArrGrounp[i]/1000;
b=(ArrGrounp[i]-a*1000)/100;
c=(ArrGrounp[i]-a*1000-b*100)/10;
d=ArrGrounp[i]-a*1000-b*100-c*10;
e=b*10+d;
f=e%4;
if(f==0)
{
ArrGrounp1[k]=ArrGrounp[i];
k++;
}
}
}
void printfData()
{
printf(DEFINE2);
for(int i=0;i< DATA ;i++)
{
if(ArrGrounp1[i]==0)
break;
printf("%d\t",ArrGrounp1[i]);
}
}
void sort()
{
int temp;
for(int i=DATA-1;i>0 ;i--)
{
if(ArrGrounp1[i]==0)
continue;
for(int j=0;j<i;j++)
{
if(ArrGrounp1[j]<ArrGrounp1[j+1])
{
temp=ArrGrounp1[j];
ArrGrounp1[j]=ArrGrounp1[j+1];
ArrGrounp1[j+1]=temp;
}
}
}
printf(DEFINE3);
for(int i=0;i<DATA;i++)
{
printf("%d\t",ArrGrounp1[i]);
}
}
2.¼òµ¥µÄ²úÆ·¹ÜÀíϵͳ£¬Á·Ï°×Ö·û´®ºê¶¨ÒåºÍ½á¹¹ÌåµÄÓ¦Óá£
#include"stdio.h"
#include"stdlib.h"
#include"string.h"
#define DEFINE1 "\nÇëÊäÈë²úÆ·Ãû³Æ£º"
#define DEFINE2 "\nÇëÊäÈë¿Í»§Ãû³Æ£º"
#define DEFINE3 "\nÇëÊäÈë¶©¹ºÊýÁ¿£º"
#define DEFINE4 "\nÇëÊäÈë²úÆ·¼Û¸ñ£º"
#define DEFINE5 "\n»¹Òª¼ÌÐøÊäÈëÂð£¿<1:¼ÌÐø 2.½áÊø>£º"
#define DEFINE6 "\n²éѯ½á¹ûÈçÏ£º\n"
#define DEFINE7 "\nÇëÊäÈë²éѯ¿Í»§Ãû³Æ£º"
#define DEFINE8 "\n¿Í»§Ãû³Æ\t\t²úÆ·Ãû³Æ\t\tÊýÁ¿\t¼Û¸ñ£º\n"
#define DEFINE "\nÇëÑ¡ÔñÄúÒªÖ´ÐеIJÙ×÷£
Ïà¹ØÎĵµ£º
ÏÈ·¢±íÒ»ÏÂÓÞ¼û£¬»¶Ó´ó»ï¶ùÅÄש£º
Visual C++£ºWindowsƽ̨ÉÏ×îÁ÷ÐеıàÒëÆ÷£¬ºÍVS¼¯³ÉµÄºÜºÃ£¬±àÒëЧÂʺͱàÒëºóµÄ´úÂëЧÂʶ¼²»´í£¬µ«ÊÇ£¬³ýÁ˱ȽϺÃÓÃÖ®Í⣬ºÃÏóûÓÐÌØ±ðÍ»³öµÄ...¶øÇÒ£¬Ö§³ÖµÄÓ²¼þƽ̨ºÃÏóÖ»ÓÐX86µÄ...
GCC/G++£º¿ªÔ´µÄ£¬Linux/Unixƽ̨ÉϵÄÊ×Ñ¡£¬¶øÇÒÖ§³ÖNÖÐÓ²¼þƽ̨£¬Èç¹ûÏë½øÐÐ¿çÆ½Ì¨±àÒëµÄ»°£¬Õâ ......
[This was posted to comp.lang.c by its author, David Anderson, on 1994-05-06.]
The ``Clockwise/Spiral Rule''
By David Anderson
There is a technique known as the ``Clockwise/Spiral Rule'' which enables any C programmer to parse in their head any C declaration!
There are three simple steps to fo ......
żȻµÄÒòËØ£¬¶ÔconstÀ´Á˵ãÐËȤ£¬×öÁËÒ»ÏÂʵÑ飺
1. Óï·¨£ºconst¡¢Ö¸Õë
ÔÚgccÖУ¬ ¶ÔÓÚCÓïÑÔ£¬ÏÂÃæµÄÓï¾äÊǺϷ¨µÄ£º
const int a=0;
int *p=&a;
¶øC++ÖУ¬ÐèÒªÊÖ¹¤Ç¿ÖÆ×ª»»²ÅÄܱàÒëͨ¹ý£º
......
extern "C"
¡¡¡¡extern "C" °üº¬Ë«Öغ¬Ò壬´Ó×ÖÃæÉϼ´¿ÉµÃµ½£ºÊ×ÏÈ£¬±»ËüÐÞÊεÄÄ¿±êÊÇ“extern”µÄ£»Æä´Î£¬±»ËüÐÞÊεÄÄ¿±êÊÇ“C”µÄ¡£ÈÃÎÒÃÇÀ´Ïêϸ½â¶ÁÕâÁ½Öغ¬Òå¡£
¡¡¡¡£¨1£© ±»extern "C"ÏÞ¶¨µÄº¯Êý»ò±äÁ¿ÊÇexternÀàÐ͵ģ»
¡¡¡¡externÊÇC/C++ÓïÑÔÖбí ......
The meaning of the c in calloc was vividly discussed in comp.lang.c in October 2000 (see here), with both clear (because, unlike malloc, calloc clears the memory it returns) and count (because, unlike malloc, calloc is passed a count of elements to allocate) suggested as possible explanations, howev ......