#include <iostream>
#include <fstream>

using namespace std;

void PrintError(fstream&, char, bool&);
int Conversion(fstream&, char&, bool&);

int main()
{
	fstream InFile;
	char Bit;
	int Decimal;
	bool BadBit = false;

	//Open file to read
	InFile.open("f:\\Binary.txt",ios::in);

	//Read the first bit of the number
	InFile.get(Bit);

	//continue reading all numbers till the end of file
	while (!InFile.eof())
	{
		//call Conversion to convert binary to decimal
		Decimal = Conversion(InFile, Bit, BadBit);

		//check if there is error
		if (BadBit)
		{
			//Print out error message 
			PrintError(InFile, Bit, BadBit);
		}
		else
			//output the equivalent value of decimal
			cout<<" = " <<Decimal<<endl;

		//read the next number
		InFile.get(Bit);		
	}

	InFile.close();

	return 0;
}

int Conversion(fstream& In, char& InBit, bool& Error)
/* Pre:  The stream is open for input.
         InBit is 1 or 0.
		 Error indicates the InBit is not One or Zero.
   Post: return the conversion of binary to decimal.
         Resets Error to true when encounter error.
*/
{
	
}


void PrintError(fstream& In, char BadOne, bool& Error)
/* Pre:  The stream is open for input.
         BadOne is bad digit.
		 Error indicates the BadOne is bad digit.
   Post: Prints error message.
         Resets Error to false means there is no error.
*/

{
	
}

hey guys can sum1 plsss do dis program for me.....trust me guys i have been doin it from 3 days but m not able to do it.......pls guys i have a submission tmr....thanks a lot

but its from decimal to binary....... n i really want sum1 to edit n work on d program i have given above....i really dont have time nor do i know how to do it....i tried as much as i could.....plsss sum1 edit my program n post it for me...

output should be as follows

1 = 1
10 = 2
11 = 3
12: Bad number!
10000 = 16
10101 = 21
13: Bad number!
end: Bad number!

Beg to Narue, she may hear your voice..

Plz rd da rulz uv da forum, an da stickies at da top. Stop using baby talk, we are adults here. And we are not a free homework service.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.