What does that mean!!! I have saerch hign and low all throughout my code and found nuthing. I just cannot figure out why this is happening to me. Here is my code. Oh and it would be nice to also explain exactly what a parse error at end of input is because on other message boards people just give your awnsers and don't really help you to know why it is happening so u can fix it yourself next time.
Code:
#include <iostream.h>
#include <stdlib.h>
char word[502];
int decimal[502];
void binary();
int main()
{ char word[502];
int decimal[502];
cout<<"\nPlease Input Some Text\n";
cin>>word;
cout<<"\nThis Is Your Text In ASCII Decimals\n";
for(int a=0;a<502;a++)
{decimal[a]=int(word[a]);
cout<<decimal[a];}
cout<<"This Is Your Text In Binary Numbers";
binary();
cout<<"\n\n Thats About It\n\n";
system("PAUSE");
return 0;
}
void binary()
{ char letter;
int len, ascii, binary[8], total;
len = strlen(word); /* get the number of characters in entry. */
/* this loop is executed for each letter in the string. */
for(int i = 0; i<len; i++)
{
total = 0;
letter = word[i]; /* store the first letter */
ascii = letter; /* put that letter into an int, so we can
see its ASCII number */
while(ascii>0) /* This while loop converts the ASCII # into binary,
stores it backwards into the binary array. */
{
/* To get the binary code one must take the decimal number in
question, take it and divide it by two repeatedly, save
the remainder (which will become the binary number), save
the whole number, divide by two, and repeat the whole
process until 0 is reached. This if-else statement serves
this functionality, by getting the remainder of the ascii
code, storing it in the array and then dividing the int
ascii by two */
if((ascii%2)==0)
{
binary[total] = 0;
ascii = ascii/2;
total++; /* increasing by one each time will yeild the
number of numbers in the array. */
}
else
{
binary[total] = 1;
ascii = ascii/2;
total++;
}
}
total--; /* due to data type factors, the program will actually
add a 0 at the end of the array that is not supposed
to be there, decrementing total will solve this
problem, as that 0 will not be displayed. */
/* this while loop displays the binary code for that letter. */
while(total>=0)
{
cout<<binary[total];
total--;
}}
by the way I am using dev-c++ version ummm 4. sumthing?