只能用C語言寫
輸入數個字元數字對,例如3K,則印出KKK,2R1T,則印出RRT,2E1A2W,則印出EEAWW
2007-06-22 15:09:05 · 2 個解答 · 發問者 貴隆 廖 2 in 電腦與網際網路 ➔ 程式設計
//Power by Visual Studio 2005
#include
#include
#include
#ifndef _MAX_ENV
#define _MAX_ENV 32767
#endif
int main(int argc, char* argv[]){
//==========START==========//
int i,j,length;
char request[_MAX_ENV];
printf("Input request: "),scanf("%s",request);
if(((length=(unsigned)strlen(request))&1)!=1)
for(i=0;i<(length>>1);i++)
for(j=0;j
//==========END==========//
printf("\n"),system("PAUSE");
return 0;
}
2007-06-22 16:39:33 · answer #1 · answered by Big_John-tw 7 · 0⤊ 0⤋
#include
void main()
{
#define aysize 100
char ay[aysize];
int i,j,num;
printf("pls keyin a string and not over 20 char :");
scanf("%s",&ay);
for (i=0;i<=aysize;i=i+2)
{
if(ay[i]!='\0')
{
if (ay[i]>=0x31 && ay[i]<=0x39)
{
num=ay[i]-0x30;
for(j=1;j<=num;++j)
printf("%c",ay[i+1]);
}
else if (ay[i]>0x39)
printf("\nformat err =>first is num and second is char\n");
else continue;
}
else break;
}
printf("\n");
return;
}
2007-06-22 16:37:59 · answer #2 · answered by Anonymous · 0⤊ 0⤋