資源簡介
一個(gè)線性反饋移位寄存器的程序,本原多項(xiàng)式直接輸入
代碼片段和文件信息
#include
#include
#include
#define?MAX?256 //定義串長度
int?*input1(int?*aint?&n){ //輸入函數(shù)1:實(shí)現(xiàn)連接多項(xiàng)式的輸入。
int?flag=0temp=0; //輸入如1+x1++x2+x5+x27#
char?c; //以井號(#)結(jié)束
printf(“請輸入多項(xiàng)式:“);
a[0]=1;
while(1){
c=getchar(); //接受一個(gè)字符
if(c==‘x‘){temp=0;flag=1;} //判斷為x,則準(zhǔn)備接受氣候的階數(shù)
else?if(c<=‘9‘&&c>=‘0‘&&flag==1)temp=temp*10+c-‘0‘; //如果為數(shù)字,保存
else?if(c==‘+‘){a[temp]=1;flag=0;} //遇到+號,表明一個(gè)階數(shù)輸入完畢,保存
else?if(c==‘#‘){a[temp]=1;flag=0;break;} //結(jié)束
}
n=temp; //n記錄最大階數(shù)
return?a;
}
char?*input2(char?*b){ //輸入函數(shù)2,輸入初始序列,使用Char類型接受比較方便
printf(“請輸入初態(tài):“);
scanf(“%s“b);
return?b;
}
char?*DSR(int?*achar?*bint?n){ //DSR
int?ijn1;
char?temp[MAX]={‘0‘}; //初始化
strcpy(tempb); //Temp用來保存d1-dn
n1=strlen(b); //初態(tài)序列的長度
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件?????184374??2008-03-06?21:19??LFSR\Debug\LFSR.exe
?????文件?????184196??2008-03-06?21:19??LFSR\Debug\LFSR.ilk
?????文件?????225984??2008-03-06?21:19??LFSR\Debug\LFSR.pch
?????文件?????369664??2008-03-06?21:19??LFSR\Debug\LFSR.pdb
?????文件???????6761??2008-03-06?21:19??LFSR\Debug\Main.obj
?????文件??????33792??2008-03-06?23:55??LFSR\Debug\vc60.idb
?????文件??????45056??2008-03-06?21:19??LFSR\Debug\vc60.pdb
?????目錄??????????0??2008-03-06?21:19??LFSR\Debug
?????文件???????4260??2008-03-06?21:58??LFSR\LFSR.dsp
?????文件????????516??2008-03-06?21:19??LFSR\LFSR.dsw
?????文件??????41984??2008-03-06?23:57??LFSR\LFSR.ncb
?????文件??????48640??2008-03-06?23:57??LFSR\LFSR.opt
?????文件???????1251??2008-03-06?21:19??LFSR\LFSR.plg
?????文件???????3030??2008-03-06?21:19??LFSR\Main.cpp
?????目錄??????????0??2008-03-06?23:57??LFSR
-----------?---------??----------?-----??----
??????????????1149508????????????????????15
評論
共有 條評論