Monday, May 24, 2010

C++ Question?

[code]


#include %26lt;iostream%26gt;


#include %26lt;fstream%26gt;


using namespace std;





int read ( char , char );





typedef struct


{


int computernum;


char fibit[8];


char sebit[8];


char thbit[8];


char fobit[8];





} address;





main ()


{


char red;


red = read (zero, one);





cout %26lt;%26lt; red %26lt;%26lt; endl;


return 0;


}





int read (char z, char o)


{


ifstream fin;


char zero;


char one;


fin.open ("prog2.dat");





if (fin.fail() )


{


cout %26lt;%26lt; "File not found or opened" %26lt;%26lt; endl;


exit(1);


}





if ( zero = 0)


{


zero= 0;


}


return 0;


}


[/code]





I am lost on the last part mostly. My instructor gave me a file named prog2.dat which contained this file





"


00001110011110010000101001011010


00000011000000110000011000000110


10010010001111110101101001010101


00000001000000010000000100000001


00000111001010111101010101110101


00000000101011110101010101110

C++ Question?
You haven't asked any question. All you've done is post some source code and input file info. What is the code supposed to do? What are you having trouble figuring out?
Reply:since int read(..) return only zero .....looks like your program will only output zeros....


so what is your question?


No comments:

Post a Comment