Results 1 to 5 of 5

Thread: โปรแกรมนับเวลา ใช้ java

  1. #1
    hackmanmusic
    Guest


    โปรแกรมนับเวลา ใช้ java

    นับเวลาอ่ะครับ ใครรู้ตอบด้วยนะครับ 00:00:00 แล้วทำการนับไปเรื่อยๆ อะ อยากรุ้จริงๆๆ ขอบคุณมากนะคับ

  2. #2
    Administrator asylu3's Avatar
    Join Date
    Jun 2000
    Location
    Thailand
    Posts
    3,557


    Re: โปรแกรมนับเวลา ใช้ java

    ไม่ยากครับแค่ทำการวนลูบแล้วก็เพิ่มค่าหลักทัดไปทุกครั้งที่ครบ 60
    ที่น่าจะต้องระวังหน่อยด็ตรงส่วนการ เพิ่มค่าทัดไปนี้แหล่ะครับที่มักจะทำผิดกันบ่อย
    คงไม่ต้องเขียนให้ดูนะครับ

  3. #3
    hackmanmusic
    Guest


    Re: โปรแกรมนับเวลา ใช้ java

    พี่เขียนให้ดูหน่อยสิครับ ???

  4. #4
    Anonymous
    Guest


    Re: โปรแกรมนับเวลา ใช้ java

    ถ้าเป็นแบบ C ก็ประมาณนี้อ่ะคับ
    แต่ถ้าเป็น Java มันคงจะ print ไล่ลงไปทีละบรรทัดมั้งนะคับ (ยาวน่าดูเลย)


    เอาแบบ C ไปก่อนละกันคับ หลักการเดียวกันแหละคับ
    [src]
    #include < stdio.h >
    #include < conio.h >
    #include < dos.h >
    main()
    {
    int H=0,M=0,S=0;
    clrscr();
    while(H!=25&&M!=60&&S!=60)
    {

    printf("%d : %d : %d",H,M,S);
    delay(1000);
    clrscr();
    S++;
    if(S==60)
    {
    S=0;
    M++;
    }
    if(M==60)
    {
    M=0;
    H++;
    }
    }
    }
    [/src]

  5. #5
    Administrator asylu3's Avatar
    Join Date
    Jun 2000
    Location
    Thailand
    Posts
    3,557


    Re: โปรแกรมนับเวลา ใช้ java

    ข้างบนคงเขียนด้วย turbo c หรือไม่ก็ borland c แต่หากใช้ VC++ ก็ใฃต้องแก้โค้ดดังนี้ครับ


    [src]
    #include < stdio.h >
    #include < conio.h >
    #include < dos.h >
    #include < stdlib.h >
    main()
    {
    int H=0,M=0,S=0;
    system("cls");
    while(H!=25&&M!=60&&S!=60)
    {

    printf("%d : %d : %d",H,M,S);
    getch();
    system("cls");
    //clrscr();
    S++;
    if(S==60)
    {
    S=0;
    M++;
    }
    if(M==60)
    {
    M=0;
    H++;
    }
    }
    }

    [/src]

Similar Threads

  1. Java, Java, Java, Object-Oriented Problem Solving
    By Black_Phoenix in forum E-Book, Video หรือบทความทั่วไปด้าน Computer
    Replies: 0
    Last Post: 25-02-2008, 11:55 PM
  2. Pro Java 6 3D Game Development: Java 3D, JOGL, JInput and JOAL APIs
    By HomHuan in forum E-Book, Video หรือบทความทั่วไปด้าน Computer
    Replies: 0
    Last Post: 24-09-2007, 05:03 PM
  3. Apress Pro Java 6 3D Game Development Java 3D JOGL JInput and JOAL APIs
    By SheLLniX in forum E-Book, Video หรือบทความทั่วไปด้าน Computer
    Replies: 0
    Last Post: 21-09-2007, 02:52 AM
  4. Replies: 0
    Last Post: 19-06-2007, 04:38 PM
  5. Java, Java Applet, Java Script ต่างกันยังไง?
    By cms-design in forum Non computer knowledge
    Replies: 0
    Last Post: 01-01-1970, 07:00 AM

Members who have read this thread : 0

Actions : (View-Readers)

There are no names to display.

Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •