How to add time delay in turbo c++ version 4.5 in windows32bit

hi guys this is my first query.....
I usually use codeblocks until my professor gave me a project in which it was mandatory to use turbo c++
so how can I create the timer effect in turbo???
eg. if i want to print 1 2 3 4.... in a gap of 2 seconds how will I do it in turbo c++?
You would do this in one IDE the same way that you would do it in another. The IDE doesn't change the syntax of the language. Is the function that you were using in C::B not available in Turbo?

Why does your professor think that which IDE you use matters? Also, why are they forcing you to use a product that is likely the same age or older then most of his students (release date ~1991)? How is this even running on any modern OS?
Last edited on
dont know.... school stuff..... our syllabus recommends to use turbo c++... also it is working perfectly on my windows 7 32bit....
turbo is pre-standard c++ compiler
for example the preprocessors are way different
1
2
#include<iostream.h>//turbo
#include<iostream>//codeblocks 
The naming convention for a file isn't what I would call a huge difference. Sure the implementation is probably different but you should still be able to use the "ctime" header as "time.h". What does your C::B code look like and what is failing for you?
turbo doesn't recognizeSleep() or delay()
Last edited on
Presumably those functions were not available for Windows 3.1.
So your professor is demanding that you use an outdated IDE that has non-standard compiler but he then allows you to use WinAPI specific functions? I don't know how to respond to that.

You should be using the "ctime"\"time.h" header file for this anyway. It won't defer processing time like "Sleep()" does, so you will be spiking your CPU, but it will allow you to access the system clock.
IMO you should consider dropping this class and sending a note to the school board about the curriculum. You're not going to learn anything worthwhile with a 15+ year old compiler. The only thing you're going to learn is how to write broken code that won't work in the real world.

EDIT:

I'm overstating that. Let me correct myself. I recommend the following:

1) Definitely send a note to the school board about the outdated curriculum. Teaching Turbo C++ in 2014 is completely unacceptable.

2) If you can find another programming course that is more modern... even if it is something other than C++ (like a Java class or something), take it, and drop your current class.

3) If there are no other classes available.. that's a bummer. Whether or not you want to stick it out is your decision. You will learn some useful things, but you'll also learn a bunch of really bad things that you will eventually have to 'unlearn'.
Last edited on
ha... i definitely have to do that........
You can use GetProcAddress() to get a function pointer to Sleep() if your compiler allows it (I never wrote 16 bit programs).
16-bit Windows? It's best to use SetTimer/KillTimer and handle the WM_TIMER message for an efficient (if not accurate) timer.
turbo doesn't recognize Sleep() or delay()


There is a delay() function in <dos.h> header

it was mandatory to use turbo c++

Bummer for you
Last edited on
kudos!!!
Topic archived. No new replies allowed.