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;
/* Åжϱä
Ïà¹ØÎĵµ£º
b/s ÊÇ brower/server ¾ÍÊÇÓÃä¯ÀÀÆ÷(Èçie)ΪӦÓóÌÐò¿Í»§¶Ë²Ù×÷·þÎñÆ÷¡£ÕâÑùÓÃä¯ÀÀÆ÷À´²Ù×÷¼òµ¥Ò×Ó㬵«ÊǶÔÊäÈëûÓкܺõÄÑéÖ¤¡£Â߼ʵÏÖ²»¶à¡£±¾µØÖ»ÊÇÓÃÓÚ»ñÈ¡Êý¾ÝÈ»ºó´ó²¿·ÖÑéÖ¤ÐèÒªÌá½»·þÎñÆ÷À´Íê³É¡£
c/s ÊÇclient/server ¿Í»§¶ËÈí¼þÔòÊÇÒ»¸öÓµÓкܶàÂß¼ÑéÖ¤µÄÈí¼þ£¬±¾µØÑéÖ¤³É¹¦ºó²ÅÌá½»·þÎñÆ÷¡£
ÎÒÕÒµ½µÄ¸ ......
C/C++ÖеÄSplitº¯ÊýÊÇstrtok()Æäº¯ÊýÔÐÍÈçÏÂ:
char * strtok (char * str, const char * delimiters);
º¯Êý˵Ã÷
strtok()ÓÃÀ´½«×Ö·û´®·Ö¸î³ÉÒ»¸ö¸öƬ¶Î¡£²ÎÊýstrÖ¸ÏòÓû·Ö¸îµÄ×Ö·û´®£¬²ÎÊýdelimitersÔòΪ·Ö¸î×Ö·û´®£¬µ±strtok()ÔÚ²ÎÊý
strµÄ×Ö·û´®Öз¢ÏÖµ½²ÎÊýdelimitersµÄ·Ö¸î×Ö·ûʱÔò»á½«¸Ã×Ö·û¸ÄΪ'\0'×Ö·û ......
Ô´Âë:
# include <stdio.h>
int main()
{
/* ¶¨ÒåÒ»¸öÕûÊýÀàÐ͵ıäÁ¿£¬ÓÃÀ´´æ·ÅºóÃæËãʽµÄÖµ */
int logic;
int a = 1;
int b = 2;
int c = 3;
&n ......
Ô´Âë:
# include <stdio.h>
int main()
{
int i, j, k;
int m, n, p;
i = 8;
j = 10;
k = 12;
/* ×ÔÔöÔÚ²Ù×÷Êý֮ǰ */
  ......
Ô´Âë:
# include <stdio.h>
int main()
{
int x, y;
printf("ÇëÊäÈë×Ô±äÁ¿x£º");
scanf("%d", &x);
if(x < 6)
{
  ......