Question:

How to run Turbo C++ programs in Dev C++ ?

by  |  earlier

0 LIKES UnLike

I have so many programs that are originally written in Turbo C++ IDE, but when i try to run them in Dev C++ then they do not compile successfully. Wonder whats the solution and why they generate errors? Take for example the following program:

// program to control a line of sign

// control the cursor

//

#include<conio.h>

#include<stdio.h>

#include<process.h>

void main()

{

char ch,

*menu[]={"first ","second","third ","fourth","fifth "},

*first[]={"one","0001"},

*second[]={"two","0002"},

*third[]={"three","0003"},

*fourth[]={"four","0004"};

int i,cur=0;

clrscr();

textcolor(3);

for(i=0;i<=4;i++)

{

gotoxy(8+13*i,3);

cprintf("%s",menu[i]);

}

_setcursortype(0);

while(1)

{

ch=getch();

switch(ch)

{

case 77:

textcolor(3);

textbackground(0);

gotoxy(8+13*cur,3);

cprintf("%s",menu[cur]);

if(cur==4)

cur=0;

else

cur++;

textcolor(0);

textbackground(3);

gotoxy(8+13*cur,3);

cprintf("%s",menu[cur]);

break;

case 75:

textcolor(3);

textbackground(0);

gotoxy(8+13*cur,3);

cprintf("%s",menu[cur]);

if(cur==0)

cur=4;

else

cur--;

textcolor(0);

textbackground(3);

gotoxy(8+13*cur,3);

cprintf("%s",menu[cur]);

break;

case 72:

break;

case 27:

exit(1);

}

}

}

Please help

 Tags:

   Report

3 ANSWERS


  1. I do not know.


  2. open up devc++

    create a new console program

    copy and paste your code

    or if its a blank project then add you file to the project.

    One main reason it might not compile is because turbo c++ is proprietary by Borland and there might be some headers/libraries that DevC++ my not support since DevC++ has a Mingw compiler.

    What are the compiler errors?

    it may not be familiar with process.h or maybe

    clrscr();

    textcolor(3);

    textbackground(3);

    haven&#039;t tried it though, try removing those entries and do pure textual representations of the program, also try changing the

    cprintf to just printf


  3. The first difference i noticed between dev c++ and turbo c++ is that

    void main() doesn&#039;t work in dev

    It shows error until you correct return type to int (i.e)

    int main()

    {

    ...

    ...//whatever

    ...

    return(0);

    }

    sounds like a lame answer but try it out...could be the problem

    also I was a little lazy to read the whole program :)

    cheers

    x*x: Checked it out...the above is also a problem

    but it is showing error after that

    so had to remove //clrscr(); , //textcolor(3); , //gotoxy(8+13*i,3); , //_setcursortype(0); and exit(0) for it to work

    probably the dont exist in the library

    still works without it

    new to dev...but learning :) adios

Question Stats

Latest activity: earlier.
This question has 3 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.
Unanswered Questions