C_ʹÓÃswitchÓï¾ä
Ô´Âë:
# include <stdio.h>
int main()
{
int num;
/* ÏÂÃæ¶¨ÒåµÄ¸÷±äÁ¿£¬·Ö±ð´ú±í¸öλ£¬Ê®Î»£¬°Ùλ£¬Ç§Î»£¬Íòλ£¬Ê®ÍòλÒÔ¼°Î»Êý */
int indiv, ten, hundred, thousand;
int ten_thousand, hundred_thousand, place;
printf("ÇëÊäÈëÒ»¸öÕûÊý(0¡«999999)£º");
scanf("%d", &num);
/* ÅжϱäÁ¿numµÄλÊý */
if(num > 99999)
place = 6;
else if(num > 9999)
place = 5;
else if(num > 999)
place = 4;
else if(num > 99)
place = 3;
else if(num > 9)
place = 2;
else
place = 1;
printf("place = %d\n", place);
printf("ÿλÊý×ÖΪ£º");
/* Çó³önumÔÚ¸÷λÉϵÄÖµ */
hundred_thousand = num/100000;
ten_thousand = (num - hundred_thousand*100000)/10000;
thousand = (num - hundred_thousand*100000 - ten_thousand*10000)/1000;
hundred = (num - hundred_thousand*100000 - ten_thousand*10000
- thousand*1000)/100;
ten = (num - hundred_thousand*100000 - ten_thousand*10000
- thousand*1000 - hundred*100)/10;
indiv = num - hundred_thousand*100000 - ten_thousand*10000
- thousand*1000 - hundred*100 - ten*10;
/* Åжϱä
Ïà¹ØÎĵµ£º
ÄÚ´æ·ÖÅ䷽ʽÓÐÈýÖÖ£º
£¨1£© ´Ó¾²Ì¬´æ´¢ÇøÓò·ÖÅä¡£ÄÚ´æÔÚ³ÌÐò±àÒëµÄʱºò¾ÍÒѾ·ÖÅäºÃ£¬Õâ¿éÄÚ´æÔÚ³ÌÐòµÄ
Õû¸öÔËÐÐÆÚ¼ä¶¼´æÔÚ¡£ÀýÈçÈ«¾Ö±äÁ¿£¬static ±äÁ¿¡£
£¨2£© ÔÚÕ»ÉÏ´´½¨¡£ÔÚÖ´Ðк¯Êýʱ£¬º¯ÊýÄÚ¾Ö²¿±äÁ¿µÄ´æ´¢µ¥Ôª¶¼¿ÉÒÔÔÚÕ»ÉÏ´´½¨£¬º¯
ÊýÖ´ÐнáÊøÊ±ÕâЩ´æ´¢µ¥Ôª×Ô¶¯±»ÊÍ·Å¡£Õ»ÄÚ´æ·ÖÅäÔËËãÄÚÖÃÓÚ´¦ÀíÆ÷µÄÖ¸Áî¼ ......
Ô´Âë:
# include <stdio.h>
int main()
{
int i, j, k;
int m, n, p;
i = 8;
j = 10;
k = 12;
/* ×ÔÔöÔÚ²Ù×÷Êý֮ǰ */
  ......
Ô´Âë:
# include <stdio.h>
int main()
{
/* ¶¨ÒåÒ»¸öÕûÐÎÖ¸Õëp */
int *p;
int begin, end;
begin = 10;
/* ¸øÖ¸Õëp¸³³õÖµ */
p = &begin;
& ......
Ô´Âë:
# include <stdio.h>
int main()
{
int x, y, z, mid, dec;
printf("ÇëÈÎÒâÊäÈëÈý¸öÕûÊý£º\n");
scanf("%d %d %d", &x, & ......
Ô´Âë:
# include <stdio.h>
int main()
{
int x, y;
printf("ÇëÊäÈë×Ô±äÁ¿x£º");
scanf("%d", &x);
if(x < 6)
{
  ......