DarkMark 0 Report post Posted July 2, 2007 aku br stat blaja programming. dulu aku gna turbo c pah2 nmpk ssh lok. Background biru g2 skt mata nengok. aku bralih nga dev c nmpk senang tp byk lok error berbanding nga turbo c ms aku compile.Ms nk kuar output pun aku ade mslh. Aku tnya lecturer ph2 dia ckp kna wat system(pause) selepas tutup main. aku wat xjadi pun. dia wat jd lok...... tkn nih Quote Share this post Link to post Share on other sites
encik pot pet 0 Report post Posted July 2, 2007 sepatutnya system("pause"); Quote Share this post Link to post Share on other sites
ApoNie 0 Report post Posted July 2, 2007 bagi aku guna micros0f visual studio 6 lagi senang.. tak perlu buat system("pause") tu.. Quote Share this post Link to post Share on other sites
troikasix 0 Report post Posted July 5, 2007 (edited) int main ( void ){ char c; cout << "Hello" << endl; cout << "Press any key to continue..." << endl; cin >> c; return 0;}[/codebox]Program akan suspended/pause sampai 'cin >>c' tu dapat execute bila user tekan apa apa key. Edited July 5, 2007 by xeonn Quote Share this post Link to post Share on other sites
ApoNie 0 Report post Posted July 5, 2007 (edited) tu untuk masukkan nilai ahh.. bukan press any key, tapi bila masuk nilai dan tekan enter, baru program tamat..untuk press anykey, cam zeph cakap...#include <iostream> using namespace std; int main () { cout << "Hello" << endl; system("pause"); //masa nie dia akan kuar press any key return 0; } Edited July 5, 2007 by ApoNie Quote Share this post Link to post Share on other sites
troikasix 0 Report post Posted July 6, 2007 tu untuk masukkan nilai ahh.. bukan press any key, tapi bila masuk nilai dan tekan enter, baru program tamat..untuk press anykey, cam zeph cakap.....system("pause"); //masa nie dia akan kuar press any keyRefer kat sini pasal system("pause') http://cpp.codenewbie.com/articles/cpp/143...USE-Page_1.html.i've seen several people use system("PAUSE") when they want to delay their programs. i'm not sure who's teaching this method, but it's a bad habit. by calling system(), you are invoking the default shell. the shell then executes the commandline given to it ("PAUSE", in this case). that is, it runs the 'pause.exe' program. so, now your simple c program is relying on two external programs for a stupid thing like pressing a single key.Dia punya sample pulak camni/* eat up characters until a newline or eof */ do { c = getchar(); if(c == EOF) break; } while(c != '\n');[/codebox]Lagipun system("pause") tu cuma kat Windows jer ada. Aku dok compile system("pause") dalam linux memanjang tak jumpa "pause" tu punya command.- Ilmu untuk dikongsi - Quote Share this post Link to post Share on other sites
DarkMark 0 Report post Posted July 6, 2007 kalu wat system("pause"); kena save ngan *.c kan? Quote Share this post Link to post Share on other sites
troikasix 0 Report post Posted July 6, 2007 kalu wat system("pause"); kena save ngan *.c kan?.cpp pun buleh. asalkan header file yang sepatutnya dah dimasukkan. system("pause").Sebaik baiknya guna format header file yang baru, macam#include <cstdio> //standard baru#include <stdio.h> //cara lama[/codebox]Kalau tengok dalam <stdio.h>, dia panggil <cstdio> jugak. Terpulang. Quote Share this post Link to post Share on other sites
mgntgrsk 0 Report post Posted July 6, 2007 (edited) Lagipun system("pause") tu cuma kat Windows jer ada. Aku dok compile system("pause") dalam linux memanjang tak jumpa "pause" tu punya command.system("<boleh isi ape2 kat sini>");universal, cume argument die tak universal,funsi system ni membolehkan kite panggil program lain dari program tu, Edited July 6, 2007 by magnitogorsk.2560-c Quote Share this post Link to post Share on other sites
ApoNie 0 Report post Posted July 6, 2007 emm.. baru aku tahu.. thanks atas ilmu tu.. Quote Share this post Link to post Share on other sites