Huffman Data Compression (C++. //read the whole file and count the ASCII char table frequencies char c. ActiveState Perl Dev Kit®, ActiveState Tcl Dev Kit.
Dev C++ Download For Free
Dev C++ Download For Window 8.1
Yes thank you ! Completely forgot about that.
#include <iostream>
#include<iomanip>
using namespace std;
void Statistics (char a []);
int main()
{
char d[]='do be do bo';
Statistics(d);
return 0;
}
void Statistics (char d [])
{
int freq[26]={0};
int i=0;
while ( d[i]!='0')
{
if (d[i]' ')
{
i++;
continue;
}
else
freq[d[i]-97]++;
i++;
}
cout<<'Letter'<<setw(30)<<'Number of ocurancen';
for (int j=0; j<26; j++)
{
if (freq[d[j]-97]0)
continue;
else
cout << d[j]<<setw(3)<<freq[d[j]-97]<<endl;
}
}
OUTPUT:
Letter Number of ocurance
00012
00032
00041
000e3
1606416648
001b32767
001c1606416568
001d32767
001e1
001f30
30
!30
'1606416448
#32767
$1606416608
%30
&1606416448
'32767
(5648
)1
*1952112456
+32767
,1606416312
-32767
.1952112456
/32767
230
41952112464
532767
6195456772
7-986691113
81606416592
932767
:2794
;1
>1646292836
?1868832869
@7299616
B195456772
C-986691113
D1606416616
E32767
F-1944721439
G32767
H-1944721439
I32767
L1
N1606416968
O32767
R1606417094
S32767
T1606417116
U32767
V1606417202
W32767
X1606417259
Y32767
Z1606417324
[32767
1606417337
]32767
^1606417354
_32767
`1606417490
a32767
b1606417543
c32767
d1606417681
e32767
f1606417691
g32767
h1606417734
i32767
j1606417753
k32767
l1606417883
m32767
n1606417899
o32767
p1606418044
q32767
r1606418078
s32767
t1606418210
u32767
x1606416840
y32767
z1606418328
{32767
|1606418347
}32767
~1606418378
32767
Why is it looking like this ??
#include <iostream>
#include<iomanip>
using namespace std;
void Statistics (char a []);
int main()
{
char d[]='do be do bo';
Statistics(d);
return 0;
}
void Statistics (char d [])
{
int freq[26]={0};
int i=0;
while ( d[i]!='0')
{
if (d[i]' ')
{
i++;
continue;
}
else
freq[d[i]-97]++;
i++;
}
cout<<'Letter'<<setw(30)<<'Number of ocurancen';
for (int j=0; j<26; j++)
{
if (freq[d[j]-97]0)
continue;
else
cout << d[j]<<setw(3)<<freq[d[j]-97]<<endl;
}
}
OUTPUT:
Letter Number of ocurance
00012
00032
00041
000e3
1606416648
001b32767
001c1606416568
001d32767
001e1
001f30
30
!30
'1606416448
#32767
$1606416608
%30
&1606416448
'32767
(5648
)1
*1952112456
+32767
,1606416312
-32767
.1952112456
/32767
230
41952112464
532767
6195456772
7-986691113
81606416592
932767
:2794
;1
>1646292836
?1868832869
@7299616
B195456772
C-986691113
D1606416616
E32767
F-1944721439
G32767
H-1944721439
I32767
L1
N1606416968
O32767
R1606417094
S32767
T1606417116
U32767
V1606417202
W32767
X1606417259
Y32767
Z1606417324
[32767
1606417337
]32767
^1606417354
_32767
`1606417490
a32767
b1606417543
c32767
d1606417681
e32767
f1606417691
g32767
h1606417734
i32767
j1606417753
k32767
l1606417883
m32767
n1606417899
o32767
p1606418044
q32767
r1606418078
s32767
t1606418210
u32767
x1606416840
y32767
z1606418328
{32767
|1606418347
}32767
~1606418378
32767
Why is it looking like this ??