hacks_80 0 Report post Posted August 30, 2004 sesapa tolong aku. aku try buat increment counter, so aku jadikan dia sebagai clock. ade sesapa yang ade idea untuk buat clock. yg ni aku guna "for". yg bestnye minute ngan second baik punye jalan. tapi yg hour ni dok stay aje. tolong aku yek#include <iostream>using namespace std;void main(){ int hour,minute; cout<<"hour :"; cin>>hour; cout<<"minute :"; cin>>minute; for(hour;hour<12;++hour) for(minute;minute<60;++minute) for(int sec=0;sec<60;++sec) { cout<<hour<<":"<<minute<<":"<<sec<<"\n"; cout<<endl; }} Quote Share this post Link to post Share on other sites
mykk 0 Report post Posted August 30, 2004 #include <iostream> using namespace std; int main() { int hour,minute; cout<<"hour :"; cin>>hour; //cout<<"minute :"; //cin>>minute; for(hour;hour<12;++hour) for(minute=0;minute<60;++minute) for(int sec=0;sec<60;++sec) cout<<hour<<":"<<minute<<":"<<sec<<endl; } Quote Share this post Link to post Share on other sites
hacks_80 0 Report post Posted September 1, 2004 aku rasa jawapan ko tak menepati soalan aku la.tapi takpe la, nice try.aku budjet nak buat dia tukar setempat aje tau.taknak dia count ke bawah.kalau boleh macam jam tangan digital tu.ade sesapa bleh tolong.plzzzz Quote Share this post Link to post Share on other sites
mykk 0 Report post Posted September 1, 2004 #include <iostream> #include <windows.h> //for Sleep function using namespace std; int main() { int hour = 0; int minute = 0; int sec = 0; cout<<"hour :"; cin>>hour; cout<<"minute :"; cin>>minute; do { system("cls"); cout<<hour<<":"<<minute<<":"<<sec<<endl; Sleep(1000); sec++; if(sec >= 60) { minute++; sec = 0; } if(minute >= 60) { hour++; minute = 0; } }while(hour < 12); } Quote Share this post Link to post Share on other sites