|
-
Aug 6th, 2007, 12:19 AM
#1
Thread Starter
Fanatic Member
console problem
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.
Dont rely only on your luck. Work hard until You get success.
vb Code:
Private sub Time_ispassing
While Me.Notgetsuccess
trygain=tryagain+1
Me.workhard
wend
end sub
-
Aug 6th, 2007, 02:05 AM
#2
Addicted Member
Re: console problem
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();
}
#Appreciate others by rating good posts !!
#The Software Peter Principle is in operation when unwise developers "improve" and "generalize" the software until they themselves can no longer understand it, then the project slowly dies.
#People who are still ignorant of their ignorance are dangerous.
-
Aug 6th, 2007, 04:24 AM
#3
Re: console problem
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();
}
-
Aug 7th, 2007, 04:14 AM
#4
Thread Starter
Fanatic Member
Re: console problem
@ Harsh
can i use getch()?
It does the same job.
Dont rely only on your luck. Work hard until You get success.
vb Code:
Private sub Time_ispassing
While Me.Notgetsuccess
trygain=tryagain+1
Me.workhard
wend
end sub
-
Aug 7th, 2007, 05:48 AM
#5
Re: console problem
I think a more pertinent question is: why are you using Turbo C++?
-
Aug 10th, 2007, 01:09 PM
#6
Thread Starter
Fanatic Member
Re: console problem
@ 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.
Dont rely only on your luck. Work hard until You get success.
vb Code:
Private sub Time_ispassing
While Me.Notgetsuccess
trygain=tryagain+1
Me.workhard
wend
end sub
-
Aug 10th, 2007, 10:17 PM
#7
Re: console problem
 Originally Posted by vivek_master146
@ 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.
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
Visual Studio 6, Visual Studio.NET 2005, MASM
-
Aug 10th, 2007, 10:26 PM
#8
Re: console problem
Also, Code::Blocks and Dev-C++ aren't compilers.
-
Aug 11th, 2007, 01:30 AM
#9
Thread Starter
Fanatic Member
Re: console problem
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?
Dont rely only on your luck. Work hard until You get success.
vb Code:
Private sub Time_ispassing
While Me.Notgetsuccess
trygain=tryagain+1
Me.workhard
wend
end sub
-
Aug 11th, 2007, 04:01 AM
#10
Re: console problem
Theres a CodeBlocks distro which comes with GCC.. I'd stick with that.
chem
Visual Studio 6, Visual Studio.NET 2005, MASM
-
Aug 11th, 2007, 06:54 PM
#11
Re: console problem
Have a look at Digital Mars they created the D language and seem to have quite a nice C/C++ compiler.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|