There is a simple program to print 1 to 10 nos. bu using for lopp. But the console closes before. I a using tubo c++ 3.0. I also added getch() but i will have to press key again and again to print 10 nos.
Printable View
There is a simple program to print 1 to 10 nos. bu using for lopp. But the console closes before. I a using tubo c++ 3.0. I also added getch() but i will have to press key again and again to print 10 nos.
Use this
Code:#include <iostream>
#include <limits>
int main() {
// Rest of the code
//Clean the stream and ask for input
std::cin.ignore ( std::numeric_limits<std::streamsize>::max(), '\n' );
std::cin.get();
}
For Turbo C++
C++ Code:
#include<iostream.h> #include<conio.h> int main() { for(int i=1; i<=10; ++i) { cout<<"Number "<<i<<"\n"; } getchar(); }
@ Harsh
can i use getch()?
It does the same job.
I think a more pertinent question is: why are you using Turbo C++?
@ Penegate. What other compiler i should use? I used codeblocks,devc++. codeblocks does not suppoert graphics.h header file. Mostprograms are written in turboc++. So i use it to learn c. Actually i m learning c.
Theres just so many things wrong with that statement.Quote:
Originally Posted by vivek_master146
Firstly, CodeBlocks (MingW) doesn't "support" the graphics.h file, because its a Borland file. It has all their other crap in there which can't be understood without the rest of the Borland header files.
Secondly, "Most programs are written in Turbo C++".. is so hilariously laughable! Where did you get that information from?
chem
Also, Code::Blocks and Dev-C++ aren't compilers.
I know code blocks and devc++ r not compilers but IDE. But i am learnig c and i have been recommended to use turbo c++ 3.0 as the book i am following also recommend to use turbo c++ for the beginners. Do u know any other good compilers which also has an ide?
Theres a CodeBlocks distro which comes with GCC.. I'd stick with that.
chem
Have a look at Digital Mars they created the D language and seem to have quite a nice C/C++ compiler.