Menampilkan Waktu sekarang C#
namespace ConsoleApplication1
{
public class Time {
// private member variables
int Year;
int Month;
int Date;
int Hour;
int Minute;
int Second;
// constructor
public Time(System.DateTime dt) {
Year = dt.Year;
Month = dt.Month;
Date = dt.Day;
Hour = dt.Hour;
Minute = dt.Minute;
Second = dt.Second;
}
// public methods
public void DisplayCurrentTime() {
System.Console.WriteLine("\n\n\t\t\t\t{0}/{1}/{2} {3}:{4}:{5}",
Month, Date, Year, Hour, Minute, Second);
Console.Read();
}
}
class LatKonstruktor {
public static void Main(string[] args) {
DateTime currTime = DateTime.Now;
Time t = new Time(currTime); //memanggil constructor
t.DisplayCurrentTime();
}
}
}
Sabtu, November 12, 2011
|
Label:
C#
|
Langganan:
Posting Komentar (Atom)
Diberdayakan oleh Blogger.
Entri Populer
-
source code ini simple bgt deh,,,hhe.....,,mklum baru bljr.... namespace ConsoleApplication1 { class Program { static...
-
source codenya pasti mantap dah,,,ckckck... namespace ConsoleApplication1 { class Program { static void Main(string[]...
-
source code program persegi bintang pada c++; #include <iostream.h> #include <conio.h> int main() { int ukuran; do ...
Buku Tamu
Arsip Blog
About Me

- Ijal Ferdi
- there is no something special about me,,, but this blog is so special for me......
1 komentar:
tq bos :D
Posting Komentar