Hello everyone this is my first posting and I need some help I' trying to convert binary number let say If have 1 convert to 0 and viceversa..
this my code:
I am using Microsoft Visual studio 2010 ..and newbie in program.. I will really apreciate your help..
/*
assignTest.cpp
int main()
{
char record[500];
int x=0;
int total=0;
int ascii;
//char record1[500];
ifstream Infile ("input.txt");
if (Infile.fail())
{
cout <<"File Not Found";
exit (1);
}
else
{
while (!Infile.eof())
{
Infile.getline(record,sizeof(record));
cout<<record<<endl;
//Start to convert charater to ascii
int ConvertAscii(int num);
int num1=strlen(record);
for (x=0;x<num1; x++)
cout <<int(record[x]);
cout<<endl;
// cout << "Proxima";
// Convert Ascii to Binary
void ToBinary(char* record) ;
{
char * temprecord;
int k = 0;
temprecord = new char[500];
while (record[k] != '\0')
{
Are you storing the value as a string? If so, iterate through the string, and when you encounter 0, set it to 1 (ASCII: Oct. 49), but if it's 1, set it to 0 (ASCII: Oct. 48). For instance: