The majority of forums are now only available as archives, which means posting/editing is disabled.
The Anything and Everything forum is still open.
The Anything and Everything forum is still open.
C++ code help
|
|||
|
Rank: Unregistered
|
Hey,
Below is a list of code translated from Pascal to C++ but with a few mistakes i think, im new to C programming and i got this task of changing the code and also i have to run it in a C compiler, when i run it in a compiler i get a lot of errors, im wondering could anyone try help me with this task as it very difficult for a beginner, maybe you could point out or fix any errors that might exist, Any help would be greatly appreciated, Regards, Colm #define combase 0x02f8 #define MCR combase+4 #define LCR combase+3 #define MSR combase+6 void Initialize_converter { Port[MCR]=3; Port[LCR]=0; } BYTE Read_value() { BYTE value=0; BYTE count; Port[MCR]=1; for (count=0;count<8;count++) { value<<=1; Port[LCR]=64; If (port[MSR] & 0x10) value++; Port[LCR]=0; } Port[MCR]=3; Read_value=value; } void main() { Initialize_converter(); do { cout << Read_value; } while (!keypressed); // keypressed is wrong, but I don't know its C(++) equivalent } The errors recieved are as follows: Line 8: Invalid function declaration Line 17: 'BYTE does not name a type Line 36: 'main' must return 'int' In function 'int main(...)': Line 37: 'Initialise_converter' undeclared (first use this function) (Each undeclared identifier is reported only once for each function it appears in) Line 39: 'cout' undeclared (first use this function) Line 39: 'Read_value' undeclared (first use this function) Line 40: 'Keypressed' undeclared (first use this function) Thats the errors as they appear to me here, any help would be greatly appreciated |
||
|
|||
|
|||
|
Rank: Unregistered
|
dude seriously get a beginners guide and read because if you read the errors it gives you the soloution the errors listed are simple for instance 'cout' undeclared you havent included the namespace using std::cout
|
||
|
Please login or register to post a reply.
