The Following User Says Thank You to slvr32 For This Useful Post: | ||
|
2011-06-15
, 17:09
|
|
Posts: 1,103 |
Thanked: 368 times |
Joined on Oct 2010
@ india, indore
|
#12
|
|
2011-06-15
, 17:11
|
|
Posts: 168 |
Thanked: 104 times |
Joined on Feb 2008
@ California, USA
|
#13
|
can you give an example here for me how to get rid of conio.h and getch()?
# include <stdio.h> int main (void) { printf ("hellow wolrd"); getchar(); }
|
2011-06-15
, 17:27
|
|
Posts: 1,103 |
Thanked: 368 times |
Joined on Oct 2010
@ india, indore
|
#14
|
|
2011-06-16
, 08:43
|
|
Posts: 850 |
Thanked: 626 times |
Joined on Sep 2009
@ Vienna, Austria
|
#15
|
there is no error now but it does not execute also(i think problem is related to device now not in programme)
BTW thanks to all you guys for so quick reply
|
2011-06-16
, 09:24
|
|
Posts: 302 |
Thanked: 193 times |
Joined on Oct 2008
@ England
|
#16
|
#include <iostream> using namespace std; main() { cout << "hello, world\n"; if (cin.get() == '\n') return 0; }
The Following 3 Users Say Thank You to Captwheeto For This Useful Post: | ||
|
2011-06-16
, 10:48
|
|
Posts: 434 |
Thanked: 990 times |
Joined on May 2010
@ Australia
|
#17
|
The Following 3 Users Say Thank You to onethreealpha For This Useful Post: | ||
|
2011-06-16
, 11:45
|
Posts: 560 |
Thanked: 422 times |
Joined on Mar 2011
|
#18
|
#include <iostream> // use correct i.e. C++ library int main() // declare return type { using namespace std; // do this inside scope cout << "hello, world"; // self-terminating string system("PAUSE"); // requires user input (keypress) to quit return 0; // return an int }
The Following 2 Users Say Thank You to demolition For This Useful Post: | ||
|
2011-06-16
, 11:54
|
|
Posts: 850 |
Thanked: 626 times |
Joined on Sep 2009
@ Vienna, Austria
|
#19
|
The Following 2 Users Say Thank You to SubCore For This Useful Post: | ||
|
2011-06-16
, 12:04
|
Posts: 673 |
Thanked: 856 times |
Joined on Mar 2006
|
#20
|
The Following User Says Thank You to momcilo For This Useful Post: | ||
But I agree with conio.h and getc() being old ms-dos legacy.
What about getchar()? Also only needs stdio.h, but I'm not sure about the buffered/unbuffered input issue.
Last edited by slvr32; 2011-06-15 at 17:17.