请版主帮我关贴。。。
1020| 4
|
关贴关贴关贴关贴关贴关贴关贴关贴关贴关贴关贴关贴 |
#include<iostream.h>
#include<stdio.h>
#include<stdlib.h>
class Errorcheck
{
private:
char *Entry, Letter, Choice[2];
int Ascii, len, Binary[8], Total;
int Checksum(int N, int a[], int m, int depth);
public:
void Convert();
void Checksum();
};
void Errorcheck::Convert()
{
Entry = new char[501];
cout << "Enter Text To Convert(Up To 500 Chars): ";
cin.getline(Entry, 500);
for(int i = 0; i < len; i++)
{
Total = 0;
Letter = Entry;
Ascii = Letter;
while(Ascii > 0)
{
if((Ascii%2)==0)
{
Binary[Total] = 0;
Ascii = Ascii/2;
Total++;
}
else
{
Binary[Total] = 1;
Ascii = Ascii/2;
Total++;
}
}
Total--;
while(Total >= 0)
{
cout << Binary[Total];
Total--;
}
}
delete[] Entry; //Freeup Memory
};
void Errorcheck::Checksum
int Check_sum(int N, int a[], int m, int depth)
{
int i;
if (depth == m-1)
{
for (i=0; i<m; i++) {
if (a == N) return 1;
}
return 0;
}
for (i=0; i<m; i++) {
if (check_sum(N-a, a, m, depth+1))
return 1;
}
return 0;
cout<<("result = %d\n", check_sum(N, a, m , 0));
};
int main()
{
Errorcheck e;
e.Convert();
e.Checksum();
}
};
谁会 Parity Check 的 coding??
hsym 发表于 2011-3-25 12:55 PM
JBTALKS.CC |联系我们 |隐私政策 |Share
GMT+8, 2025-3-11 12:38 AM , Processed in 0.082418 second(s), 25 queries .
Powered by Discuz! X2.5 © 2001-2012 Comsenz Inc.
本论坛言论纯属发表者个人意见,与本论坛立场无关
Copyright © 2003-2012 JBTALKS.CC All Rights Reserved
Dedicated Server powered by iCore Technology Sdn. Bhd.