scaner改為scanf
目前創(chuàng)新互聯(lián)已為1000+的企業(yè)提供了網(wǎng)站建設(shè)、域名、雅安服務(wù)器托管、網(wǎng)站托管維護(hù)、企業(yè)網(wǎng)站設(shè)計(jì)、大竹網(wǎng)站維護(hù)等服務(wù),公司將堅(jiān)持客戶導(dǎo)向、應(yīng)用為本的策略,正道將秉承"和諧、參與、激情"的文化,與客戶和合作伙伴齊心協(xié)力一起成長(zhǎng),共同發(fā)展。
如果是自己定義的函數(shù),需要有具體的代碼。
#include "stdio.h" /*定義I/O庫(kù)所用的某些宏和變量*/
#include "string.h" /*定義字符串庫(kù)函數(shù)*/
#include "conio.h" /*提供有關(guān)屏幕窗口操作函數(shù)*/
#include "ctype.h" /*分類函數(shù)*/
char prog[80]=,
token[8]; /*存放構(gòu)成單詞符號(hào)的字符串*/
char ch;
int syn, /*存放單詞字符的種別碼*/
n,
sum, /*存放整數(shù)型單詞*/
m,p; /*p是緩沖區(qū)prog的指針,m是token的指針*/
char *rwtab[6]=;
void scaner(){
m=0;
sum=0;
for(n=0;n8;n++)
token[n]='\0';
ch=prog[p++];
while(ch==' ')
ch=prog[p++];
if(isalpha(ch)) /*ch為字母字符*/{
while(isalpha(ch)||isdigit(ch)) /*ch 為字母字符或者數(shù)字字符*/{
token[m++]=ch;
ch=prog[p++];}
token[m++]='\0';
ch=prog[p--];
syn=10;
for(n=0;n6;n++)
if(strcmp(token,rwtab[n])==0) /*字符串的比較*/{
syn=n+1;
break;}}
else
if(isdigit(ch)) /*ch是數(shù)字字符*/{
while(isdigit(ch)) /*ch是數(shù)字字符*/{
sum=sum*10+ch-'0';
ch=prog[p++];}
ch=prog[p--];
syn=11;}
else
switch(ch){
case'':m=0;token[m++]=ch;ch=prog[p++];
if(ch==''){
syn=21;
token[m++]=ch;}
else if(ch=='='){
syn=22;
token[m++]=ch;}
else{
syn=20;
ch=prog[p--];}
break;
case'':m=0;token[m++]=ch;ch=prog[p++];
if(ch=='='){
syn=24;
token[m++]=ch;}
else{
syn=23;
ch=prog[p--];}
break;
case':':m=0;token[m++]=ch;ch=prog[p++];
if(ch=='='){
syn=18;
token[m++]=ch;}
else{
syn=17;
ch=prog[p--];}
break;
case'+':syn=13;token[0]=ch;break;
case'-':syn=14;token[0]=ch;break;
case'*':syn=15;token[0]=ch;break;
case'/':syn=16;token[0]=ch;break;
case'=':syn=25;token[0]=ch;break;
case';':syn=26;token[0]=ch;break;
case'(':syn=27;token[0]=ch;break;
case')':syn=28;token[0]=ch;break;
case'#':syn=0;token[0]=ch;break;
default:syn=-1;}}
main()
{
printf("\n\nThe significance of the figures:\n"
"1.figures 1 to 6 said Keyword\n"
"2.figures 10 and 11 said Other indicators\n"
"3.figures 13 to 28 said Operators\n");
p=0;
printf("\nplease input string:\n");
do {
ch=getchar();
prog[p++]=ch;
}while(ch!='#');
p=0;
do{
scaner();
switch(syn){
case 11: printf("(%d,%d)\n",syn,sum);break;
case -1: printf("\n ERROR;\n");break;
default: printf("(%d,%s)\n",syn,token);
}
}while(syn!=0);
getch();
}
程序測(cè)試結(jié)果
對(duì)源程序begin x:=9: if x9 then x:=2*x+1/3; end #的源文件,經(jīng)過(guò)詞法分析后輸出如下圖5-1所示:
具體的你在修改修改吧
時(shí)間:2012-10-30 晚
要求:輸入一串字符串,對(duì)其進(jìn)行詞法分析,并且按照(種別,字符串/數(shù)字)格式進(jìn)行輸出
種別編碼:
符號(hào) 種別 符號(hào) 種別 符號(hào) 種別
begin 1 + 13 = 22
if 2 - 14 23
then 3 * 15 = 24
while 4 / 16 = 25
do 5 : 17 ; 26
end 6 := 18 ( 27
l(l|d)* 10 20 ) 28
數(shù)字① 11 21 # 0
①數(shù)字的詞法正規(guī)式如下:( +|-|ε ) dd*(.dd* | ε)( e ( +|-|ε ) dd*|ε)
ps:輸入的字符串以“#”結(jié)尾
運(yùn)行環(huán)境:VC++6.0
說(shuō)明:搜索網(wǎng)上的資源,大部分的“數(shù)字”部分都是dd*形式,但這次試驗(yàn)要求的是①形式,因而在數(shù)字部分做了很大努力。與dd*形式的不同有三個(gè)地方——ch是數(shù)字時(shí),ch是+后接著是數(shù)字形式,ch是-后接著是數(shù)字形式。然而由于水平有限,時(shí)間較短,每個(gè)“加號(hào)”或“減號(hào)”后必須要在輸入數(shù)字正負(fù)符號(hào),否則會(huì)默認(rèn)“+”“-”為正負(fù)符號(hào)而不是“加號(hào)”“減號(hào)”。希望能有簡(jiǎn)單方法解決這個(gè)問(wèn)題。
源代碼:
#include stdio.h //定義I/O庫(kù)所用的某些宏和變量
#include string.h //定義字符串庫(kù)函數(shù)
#include math.h //定義數(shù)學(xué)運(yùn)算符號(hào)庫(kù)函數(shù)
char prog[80],token[8]; //prog:緩沖區(qū);token:一個(gè)有意義的字符串
char ch; //ch:當(dāng)前處理的字符
int syn,p,m,n,f,e;
//syn:類別;p,m,n:計(jì)數(shù)變量;f,標(biāo)記數(shù)字正負(fù);e,10的次方數(shù)
double sum; //sum,數(shù)字
char *rwtab[6]={"begin","if","then","while","do","end"};
//基本字表置初值
void main(void) //主函數(shù)
{
void scaner(void); //聲明函數(shù)
p=0;
printf("\n請(qǐng)輸入字符串:\n");
do{ //輸入的字符放入緩沖區(qū)
ch=getchar();
prog[p++]=ch;
}while(ch!='#');
p=0;
do{ //分析詞法并輸出結(jié)果
scaner();
switch(syn)
{
case 11:printf("(%2d,%16g)\n",syn,sum);break;
case -1:printf("輸入錯(cuò)誤\n");break;
default:printf("(%2d,%16s)\n",syn,token);
}
}while(syn!=0);
}
void scaner(void)
{
for(n=0;n8;n++) //token初始化
token[n]=NULL;
ch=prog[p++];
while(ch==' ') //如果取消空字符(目前空字符只包括空格)
ch=prog[p++];
if((ch='a'ch='z')||(ch='A'ch='Z'))
//如果ch是字母字符
{
m=0;
while((ch='a'ch='z')||(ch='A'ch='Z')||(ch='0'ch='9'))
//如果ch是字母字符或數(shù)字字符
{
token[m++]=ch;
ch=prog[p++]; //讀下一個(gè)字符
}
token[m++]='\0';
p--;
syn=10;
for(n=0;n6;n++)
if(strcmp(token,rwtab[n])==0)
{
syn=n+1; //給出syn值
break;
}
}
else if(ch='0'ch='9') //數(shù)字(1)
{
sum=0;
while(ch='0'ch='9')
{
sum=sum*10+ch-'0';
ch=prog[p++];
}
if(ch=='.') //有小數(shù)點(diǎn)
{
e=-1;
ch=prog[p++];
if(ch='0'ch='9')
{
while(ch='0'ch='9')
{
sum=sum+(ch-'0')*pow(10,e--);
ch=prog[p++];
}
}
}
if(ch=='e'||ch=='E') //有e
{
e=0,f=1;
ch=prog[p++];
if(ch=='+')
{
f=1;
ch=prog[p++];
}
else if(ch=='-')
{
f=-1;
ch=prog[p++];
}
if(ch='0'ch='9')
{
while(ch='0'ch='9')
{
e=e*10+ch-'0';
ch=prog[p++];
}
}
e=e*f;
sum=sum*pow(10,e);
}
p--;
syn=11;
}
else switch(ch)
{
case '':
m=0;
token[m++]=ch;
ch=prog[p++];
if(ch=='') //
{
syn=21;
token[m++]=ch;
}
else if(ch=='=') //=
{
syn=22;
token[m++]=ch;
}
else //
{
syn=20;
p--;
}
break;
case '':
m=0;
token[m++]=ch;
ch=prog[p++];
if(ch=='=') //=
{
syn=24;
token[m++]=ch;
}
else //
{
syn=23;
p--;
}
break;
case ':':
m=0;
token[m++]=ch;
ch=prog[p++];
if(ch=='=') //:=
{
syn=18;
token[m++]=ch;
}
else //:
{
syn=17;
p--;
}
break;
case '+':
ch=prog[p++];
if(ch='0'ch='9') //數(shù)字(2)
{
sum=0;
while(ch='0'ch='9')
{
sum=sum*10+ch-'0';
ch=prog[p++];
}
if(ch=='.') //有小數(shù)點(diǎn)
{
e=-1;
ch=prog[p++];
if(ch='0'ch='9')
{
while(ch='0'ch='9')
{
sum=sum+(ch-'0')*pow(10,e--);
ch=prog[p++];
}
}
}
if(ch=='e'||ch=='E') //有e
{
e=0,f=1;
ch=prog[p++];
if(ch=='+')
{
f=1;
ch=prog[p++];
}
else if(ch=='-')
{
f=-1;
ch=prog[p++];
}
if(ch='0'ch='9')
{
while(ch='0'ch='9')
{
e=e*10+ch-'0';
ch=prog[p++];
}
}
e=e*f;
sum=sum*pow(10,e);
}
p--;
syn=11;
}
else //+
{
syn=13;
p--;
ch=prog[p-1];
token[0]=ch;
}
break;
case '-':
ch=prog[p++];
if(ch='0'ch='9') //數(shù)字(3)
{
sum=0;
while(ch='0'ch='9')
{
sum=sum*10+ch-'0';
ch=prog[p++];
}
if(ch=='.') //有小數(shù)點(diǎn)
{
e=-1;
ch=prog[p++];
if(ch='0'ch='9')
{
while(ch='0'ch='9')
{
sum=sum+(ch-'0')*pow(10,e--);
ch=prog[p++];
}
}
}
if(ch=='e'||ch=='E') //有e
{
e=0,f=1;
ch=prog[p++];
if(ch=='+')
{
f=1;
ch=prog[p++];
}
else if(ch=='-')
{
f=-1;
ch=prog[p++];
}
if(ch='0'ch='9')
{
while(ch='0'ch='9')
{
e=e*10+ch-'0';
ch=prog[p++];
}
}
e=e*f;
sum=sum*pow(10,e);
}
sum=-sum;
p--;
syn=11;
}
else //-
{
syn=13;
p--;
ch=prog[p-1];
token[0]=ch;
}
break;
case '*': syn=15;token[0]=ch;break;
case '/': syn=16;token[0]=ch;break;
case '=': syn=25;token[0]=ch;break;
case ';': syn=26;token[0]=ch;break;
case '(': syn=27;token[0]=ch;break;
case ')': syn=28;token[0]=ch;break;
case '#': syn=0;token[0]=ch;break;
default: syn=-1;
}
}
試試吧
新建一個(gè)文本文檔在你工程目錄下,名字起為"輸入.txt",里面的內(nèi)容可以為
begin a:=1+7*(6+3);b:=1end#
輸出是在"輸出.txt"中查看,以下為輸出情況:
詞法分析結(jié)果如下:
(1, begin)
(10, a)
(18, :=)
(11, 1)
(13, +)
(11, 7)
(15, *)
(27, ()
(11, 6)
(13, +)
(11, 3)
(28, ))
(26, ;)
(10, b)
(18, :=)
(11, 1)
(6, end)
(0, #)
語(yǔ)法分析結(jié)果如下:(以四元式形式輸出)
( +, 6, 3, t1)
( *, 7, t1, t2)
( +, 1, t2, t3)
( =, t3, __, a)
( =, 1, __, b)
//提供一個(gè)編譯原理的語(yǔ)義分析程序 你可以直接復(fù)制 用TC進(jìn)行調(diào)試
#include "stdio.h"
#include "string.h"
#include malloc.h
#include conio.h
#include "stdlib.h"
char prog[100],token[8],ch;
char *rwtab[6]={"begin","if","then","while","do","end"};
int syn,p,m,n,sum,q;
int kk;
//四元式表的結(jié)構(gòu)如下:
struct
{
char result1[8];
char ag11[8];
char op1[8];
char ag21[8];
}quad[20];
char *factor();
char *expression();
int yucu();
char *term();
int statement();
int lrparser();
char *newtemp();
void scaner();
void emit(char *result,char *ag1,char *op,char *ag2);
void main()
{
FILE *fp1,*fp2;
if((fp1=fopen("輸入.txt","rt"))==NULL)
{
printf("Cannot open 輸入.txt\n");
getch();
exit(1);
}
if((fp2=fopen("輸出.txt","wt+"))==NULL)
{
printf("Cannot create 輸出.txt FILE.strike any key exit");
getch();
exit(1);
}
int j;
q=p=kk=0;
p=0;
//printf("Please Input a String(end with '#'):\n");
while(ch!='#')
{
ch = fgetc(fp1);
if(ch == EOF)
{
printf("文件為空,請(qǐng)檢查后再嘗試!");
return ;
}
prog[p++]=ch;
}
if(prog[p]=='#')
{
printf("輸入的待分析的串不是以'#'結(jié)尾,請(qǐng)修改之后再嘗試!\n");
return;
}
p=0;
char buffer1[200] = {0};
sprintf(buffer1,"詞法分析結(jié)果如下:\n");
fputs(buffer1,fp2);
//printf("詞法分析結(jié)果如下:\n");
do
{
scaner();
switch(syn)
{
case 11:
//printf("(%d,%d)\n",syn,sum);
sprintf(buffer1,"(%d, %d) \n",syn,sum);
fputs(buffer1,fp2);
break;
default:
//printf("(%d,%s)\n",syn,token);
sprintf(buffer1,"(%d, %s)\n",syn,token);
fputs(buffer1,fp2);
break;
}
}while(syn!=0);
printf("\n");
p=0;
char buffer[200]={0};
sprintf(buffer,"語(yǔ)法分析結(jié)果如下:(以四元式形式輸出)\n");
fputs(buffer,fp2);
//printf("語(yǔ)法分析結(jié)果如下:(以四元式形式輸出)\n");
scaner();//掃描函數(shù)
lrparser();
if(q19)
printf(" to long sentense!\n");
else
{
for (j=0;jq;j++)
{
//printf("( %s, %s, %s, %s) \n\n",quad[j].op1,quad[j].ag11,quad[j].ag21,quad[j].result1);
sprintf(buffer,"( %s, %s, %s, %s) \n\n",quad[j].op1,quad[j].ag11,quad[j].ag21,quad[j].result1);
fputs(buffer,fp2);
}
}
printf("已把相應(yīng)的詞法和語(yǔ)法的結(jié)果保存到相應(yīng)的文件中,請(qǐng)查閱!\n");
fclose(fp1);
fclose(fp2);
}
int lrparser()
{
int schain=0;
kk=0;
if (syn==1) //得到begin
{
scaner();//掃描下個(gè)字符
schain=yucu();
if(syn==6)//得到end
{
scaner();//掃描下個(gè)字符
if((syn==0)(kk==0)) //得到#
printf("Success!\n");
}
else
{
if(kk!=1)
printf("short of 'end' !\n");
kk=1;
getch();
exit(0);
}
}
else
{
printf("short of 'begin' !\n");
kk=1;
getch();
exit(0);
}
return (schain);
}
int yucu()
{
int schain=0;
schain=statement();
while(syn==26)
{
scaner();
schain=statement();
}
return (schain);
}
int statement()
{
char tt[8],eplace[8];
int schain=0;
if (syn==10)
{
strcpy(tt,token); //tt中保存的是第一個(gè)字符
scaner();
if(syn==18) //檢測(cè)到=號(hào)
{
scaner();
strcpy(eplace,expression());
emit(tt,eplace,"=","__");
schain=0;
}
else
{
printf("short of sign ':=' !\n");
kk=1;
getch();
exit(0);
}
return (schain);
}
}
char *expression()
{
char *tp,*ep2,*eplace,*tt;
tp=(char *)malloc(12);
ep2=(char *)malloc(12);
eplace=(char *)malloc(12);
tt=(char *)malloc(12);
strcpy(eplace,term());
while((syn==13)||(syn==14))
{
if (syn==13)
strcpy(tt,"+");
else
strcpy(tt,"-");
scaner();
strcpy(ep2,term());
strcpy(tp,newtemp());
emit(tp,eplace,tt,ep2);
strcpy(eplace,tp);
}
return (eplace);
}
char *term()
{
char *tp,*ep2,*eplace,*tt;
tp=(char *)malloc(12);
ep2=(char *)malloc(12);
eplace=(char *)malloc(12);
tt=(char *)malloc(12);
strcpy(eplace,factor());
while((syn==15)||(syn==16))
{
if (syn==15)
strcpy(tt,"*");
else
strcpy(tt,"/");
scaner();
strcpy(ep2,factor());
strcpy(tp,newtemp());
emit(tp,eplace,tt,ep2);
strcpy(eplace,tp);
}
return (eplace);
}
char *factor()
{
char *fplace;
fplace=(char *)malloc(12);
strcpy(fplace,"");
if(syn==10) //得到字符
{
strcpy(fplace,token);
scaner();
}
else if(syn==11) //得到數(shù)字
{
itoa(sum,fplace,10);
scaner();
}
else if(syn==27) //得到)
{
scaner();
fplace=expression();
if(syn==28) //得到(
scaner();
else
{
printf("error on ')' !\n");
kk=1;
getch();
exit(0);
}
}
else
{
printf("error on '(' !\n");
kk=1;
getch();
exit(0);
}
return (fplace);
}
//該函數(shù)回送一個(gè)新的臨時(shí)變量名,臨時(shí)變量名產(chǎn)生的順序?yàn)門(mén)1,T2...
char *newtemp()
{
char *p;
char m[8];
p=(char *)malloc(8);
kk++;
itoa(kk,m,10);
strcpy(p+1,m);
p[0]='t';
return(p); //設(shè)置中間變量名放在一個(gè)字符數(shù)組中,字符數(shù)組的第一個(gè)字符為t第二個(gè)字符為m表示的數(shù)值
}
void scaner()
{
sum=0;
///for(m=0;m8;m++)
//token[m++]=NULL;
memset(token,0,8);
m=0;
ch=prog[p++];
while(ch==' ')
ch=prog[p++];
if(((ch='z')(ch='a'))||((ch='Z')(ch='A')))
{
while(((ch='z')(ch='a'))||((ch='Z')(ch='A'))||((ch='0')(ch='9')))
{
token[m++]=ch;
ch=prog[p++];
}
p--;
syn=10;
token[m++]='\0';
for(n=0;n6;n++)
if(strcmp(token,rwtab[n])==0)
{
syn=n+1;
break;
}
}
else if((ch='0')(ch='9'))
{
while((ch='0')(ch='9'))
{
sum=sum*10+ch-'0';
ch=prog[p++];
}
p--;
syn=11;
}
else switch(ch)
{
case '':m=0;
ch=prog[p++];
if(ch=='')
{
syn=21;
}
else if(ch=='=')
{
syn=22;
}
else
{
syn=20;
p--;
}
break;
case '':m=0;
ch=prog[p++];
if(ch=='=')
{
syn=24;
}
else
{
syn=23;
p--;
}
break;
case ':':m=0;
token[m++] = ch;
ch=prog[p++];
if(ch=='=')
{
syn=18;
token[m++] = ch;
}
else
{
syn=17;
p--;
}
break;
case '+': syn=13;token[0] = ch; break;
case '-': syn=14;token[0] = ch; break;
case '*': syn=15;token[0] = ch;break;
case '/': syn=16;token[0] = ch;break;
case '(': syn=27;token[0] = ch;break;
case ')': syn=28;token[0] = ch;break;
case '=': syn=25;token[0] = ch;break;
case ';': syn=26;token[0] = ch;break;
case '#': syn=0;token[0] = ch;break;
default: syn=-1;break;
}
}
//該函數(shù)是生成一個(gè)三地址語(yǔ)句送到四元式表中
void emit(char *result,char *ag1,char *op,char *ag2)
{
strcpy(quad[q].result1,result);
strcpy(quad[q].ag11,ag1);
strcpy(quad[q].op1,op);
strcpy(quad[q].ag21,ag2);
q++; //統(tǒng)計(jì)有多少個(gè)四元式
}
#include stdio.h
#include stdlib.h
#include string.h
#define _KEY_WORD_END "waiting for your expanding"
typedef struct
{
int typenum;
char * word;
} WORD;
char input[255];
char token[255]="";
int p_input;
int p_token;
char ch;
char* KEY_WORDS[]={"main","int","char","if","else","for","while",_KEY_WORD_END};
WORD* scaner();
void main()
{
int over=1;
WORD* oneword=new WORD;
printf("Enter Your words(end with $):");
scanf("%[^$]s",input);
p_input=0;
printf("Your words:\n%s\n",input);
while(over1000over!=-1){
oneword=scaner();
if(oneword-typenum1000)
printf("(%d,%s)",oneword-typenum,oneword-word);
over=oneword-typenum;
}
printf("\npress # to exit:");
scanf("%[^#]s",input);
}
char m_getch(){
ch=input[p_input];
p_input=p_input+1;
return (ch);
}
void getbc(){
while(ch==' '||ch==10){
ch=input[p_input];
p_input=p_input+1;
}
}
void concat(){
token[p_token]=ch;
p_token=p_token+1;
token[p_token]='\0';
}
int letter(){
if(ch='a'ch='z'||ch='A'ch='Z')return 1;
else return 0;
}
int digit(){
if(ch='0'ch='9')return 1;
else return 0;
}
int reserve(){
int i=0;
while(strcmp(KEY_WORDS[i],_KEY_WORD_END)){
if(!strcmp(KEY_WORDS[i],token)){
return i+1;
}
i=i+1;
}
return 10;
}
void retract(){
p_input=p_input-1;
}
char* dtb(){
return NULL;
}
WORD* scaner(){
WORD* myword=new WORD;
myword-typenum=10;
myword-word="";
p_token=0;
m_getch();
getbc();
if(letter()){
while(letter()||digit()){
concat();
m_getch();
}
retract();
myword-typenum=reserve();
myword-word=token;
return(myword);
}
else if(digit()){
while(digit()){
concat();
m_getch();
}
retract();
myword-typenum=20;
myword-word=token;
return(myword);
}
else switch(ch){
case '=': m_getch();
if (ch=='='){
myword-typenum=39;
myword-word="==";
return(myword);
}
retract();
myword-typenum=21;
myword-word="=";
return(myword);
break;
case '+': myword-typenum=22;
myword-word="+";
return(myword);
break;
case '-': myword-typenum=23;
myword-word="-";
return(myword);
break;
case '*': myword-typenum=24;
myword-word="*";
return(myword);
break;
case '/': myword-typenum=25;
myword-word="/";
return(myword);
break;
case '(': myword-typenum=26;
myword-word="(";
return(myword);
break;
case ')': myword-typenum=27;
myword-word=")";
return(myword);
break;
case '[': myword-typenum=28;
myword-word="[";
return(myword);
break;
case ']': myword-typenum=29;
myword-word="]";
return(myword);
break;
case '{': myword-typenum=30;
myword-word="{";
return(myword);
break;
case '}': myword-typenum=31;
myword-word="}";
return(myword);
break;
case ',': myword-typenum=32;
myword-word=",";
return(myword);
break;
case ':': myword-typenum=33;
myword-word=":";
return(myword);
break;
case ';': myword-typenum=34;
myword-word=";";
return(myword);
break;
case '': m_getch();
if (ch=='='){
myword-typenum=37;
myword-word="=";
return(myword);
}
retract();
myword-typenum=35;
myword-word="";
return(myword);
break;
case '': m_getch();
if (ch=='='){
myword-typenum=38;
myword-word="=";
return(myword);
}
retract();
myword-typenum=36;
myword-word="";
return(myword);
break;
case '!': m_getch();
if (ch=='='){
myword-typenum=40;
myword-word="!=";
return(myword);
}
retract();
myword-typenum=-1;
myword-word="ERROR";
return(myword);
break;
case '\0': myword-typenum=1000;
myword-word="OVER";
return(myword);
break;
default: myword-typenum=-1;
myword-word="ERROR";
return(myword);
}
}
圖片轉(zhuǎn)換成代碼 -- scaner (掃描儀)就是干這個(gè)的。
有的三合一打印機(jī)(打印機(jī),fax, 掃描儀三合一)也可以干這個(gè)。
數(shù)碼相機(jī)也干這個(gè)。圖片轉(zhuǎn)換成的格式有 jpg,bmp,tif 等等,許多程序和軟件都能處理。
本文題目:C語(yǔ)言scaner函數(shù) r scan函數(shù)
本文地址:http://jinyejixie.com/article48/dodhgep.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供商城網(wǎng)站、網(wǎng)站排名、網(wǎng)站設(shè)計(jì)、網(wǎng)站內(nèi)鏈、定制網(wǎng)站、企業(yè)網(wǎng)站制作
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)