91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡介

將源文件source.c中的內容轉換為二元組,在命令提示符窗口輸出,使用C語言編寫

資源截圖

代碼片段和文件信息

#include?
#include?
#include?
#include?
#define?NULL?0
FILE?*fp;//文件指針
char?str;
char?*keyword[]={
“auto““bool““break““case““catch““char““class“
“const““const_cast““continue““default““delete““do““double“
“dynamic_cast““else““enum““explicit““extern““false““float“
“for““friend““goto““if““inline““int““long“
“mutable““namespace““new““operator““private““protected““public“
“register““reinterpret_case““return““short““signed““sizeof““static“
“static_cast““struct““switch““template““this““throw““true“
“try““typedef““typeid““typename““union““unsigned““using“
“virtual““void““volatile““while“};//建立關鍵字指針數組

int?search(char?searchstr[]int?wordtype)?//標識符匹配
{?
?int?p;
?int?i=0;?
?switch?(wordtype)?
?{?
?case?1:
?for(i=0;i<=59;i++)?
?{?
?if(strcmp(keyword[i]searchstr)==0)?//字符串比較
?{p=i+1;?break;}
?else?p=0;
?} ???
?}
?return(p);
}?

char?letterprocess(char?ch)//字母處理函數
{
int?i=-1;
char?letter[20];
while(isalnum(ch)!=0||ch==‘_‘)//讀取到的為數字或字母或下劃線
{
letter[++i]=ch;
ch=fgetc(fp);
};
letter[i+1]=‘\0‘;
if(search(letter1))//查關鍵字表,找到為關鍵字,否則為標識符
{
printf(“(%s關鍵字)\n“letter);
}else{printf(“(%s標識符)\n“letter);}
return(ch);
}

char?numberprocess(char?ch)//數字處理函數
{
int?i=-1;
char?number[20];
while(isdigit(ch)||ch==‘.‘)//讀取為數字或小數點
{
number[++i]=ch;
ch=fgetc(fp);
}
number[i+1]=‘\0‘;
printf(“(%s數字或小數點)\n“number);
return?(ch);
}

char?otherprocess(char?ch){//處理非數字和字母函數
char?other[20];
other[0]=ch;
other[1]=‘\0‘;
if(ch==‘{‘||ch==‘}‘||ch==‘(‘||ch==‘)‘||ch==‘‘||ch==‘;‘||ch==‘#‘||ch==‘“‘||ch==‘.‘)//分隔符識別
{
printf(“(%s分隔符)\n“other);
ch=fgetc(fp);
return(ch);
}
else?if(ch==‘+‘||ch==‘*‘||ch==‘/‘||ch==‘%‘)//操作運算符識別
{
printf(“(%s操作運算符)\n“other);
ch=fgetc(fp);
return(ch);
}else?if(ch==‘<‘||ch==‘>‘||ch==‘=‘||ch==‘!‘)//比較運算符識別
{
ch=fgetc(fp);//超前閱讀,取其下一個字符,如為‘=’則將其寫入數組中,否則只輸出當前讀取的字符
if(ch==‘=‘)
{
other[1]=ch;
other[2]=‘\0‘;
printf(“(%s比較運算符)\n“other);
return(ch);
}
else
{
printf(“(%s賦值運算符)\n“other);
return?ch;
}
}else?if(ch==‘&‘)//識別‘&’與‘&&’
{
ch=fgetc(fp);//超前閱讀
if(ch==‘&‘)//如果其后一個字符為‘&’,則將其后一個字符也寫入數組中并輸出
{
other[1]=ch;
other[2]=‘\0‘;
printf(“(%s邏輯與運算符)\n“other);
return(ch);
}else
{
printf(“(%s地址與或按位與運算符)\n“other);
return(ch);
}
}else?if(ch==‘\\‘)//識別‘\n’
{
ch=fgetc(fp);
if(ch==‘n‘)
{
other[1]=ch;
other[2]=‘\0‘;
printf(“(%s換行符)\n“other);
return(ch);
}
}else?if(ch==‘-‘)//判斷‘-’是負號還是減號
{
ch=fgetc((fp-1));//取其前一個字符,如果為數字則為減號,否則為負號
if(isdigit(ch))
{
ch=fgetc((fp+1));//指針回指到下一個字符,取下一個字符
other[1]=ch;
other[2]=‘\0‘;
printf(“(%s負號)\n“other);
return(ch);
}else
{
other[1]=ch;
ch=fgetc(fp);
other[2]=ch;
other[3]=‘\0‘;
printf(“(%s減號)\n“other);
ch=fgetc(fp);
re

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件???????3893??2011-07-02?23:35??right\code.cpp

?????文件???????3377??2011-06-17?23:17??right\code.dsp

?????文件????????533??2011-06-18?00:03??right\code.dsw

?????文件??????41984??2011-07-02?23:43??right\code.ncb

?????文件??????48640??2011-07-02?23:43??right\code.opt

?????文件???????1167??2011-07-02?23:35??right\code.plg

?????文件?????184433??2011-07-02?23:35??right\Debug\code.exe

?????文件??????20034??2011-07-02?23:35??right\Debug\code.obj

?????文件?????476160??2011-07-02?23:35??right\Debug\code.pdb

?????文件??????53248??2011-07-02?23:35??right\Debug\vc60.pdb

?????文件?????????50??2011-07-02?23:34??right\source.c

?????文件?????????44??2011-07-02?23:34??right\source.c.bak

?????目錄??????????0??2011-07-20?18:56??right\Debug

?????目錄??????????0??2011-07-02?23:43??right

-----------?---------??----------?-----??----

???????????????833563????????????????????14


評論

共有 條評論