Tuesday, July 28, 2009

Urgent..change C++ code to C?

hi,


My friend did this program for me in C++ ,and he doesnt know any thing about C,


then our lecturer told me the whole code should be in C language,so I changed some of it and the rest I couldnt .





I couldn't find library in C instead of


#include %26lt;Conio.h%26gt;





also there are some functions should be manipulate it .Can you help me plz?





i put the whole code in this link:


http://www.freewebs.com/radicalfunction/...





ur help highly appreciated..

Urgent..change C++ code to C?
Here is the source that compiles under C.





I had to write the clrscr function, defined the getch macro, change Stdio.h to stdio.h, deleted the Conio.h line. Then it worked.








http://www.thehansens.com/free/DealMatri...
Reply:conio.h works with c


your code seems almost working in c


save the program with c extension and the run it


it will work i think if not by errors u can see wats wrong and it would be easy for u to change
Reply:First, in order for your functions to follow your main(), you need to include function prototypes. You'll get a compiler error about not knowing what your functions are. Either move all of your functions above main() OR include function prototypes above the main() function as in:





int menu(void);





Next, clrscr(); is not an ansi function and won't be recognized by many compilers. You either need to figure out what the correct escape sequence is to clear the screen and include that in a printf statement, or issue something like system("cls");





Lastly, the exit() call requires stdlib.h


No comments:

Post a Comment