顯示具有 [C#基礎] 標籤的文章。 顯示所有文章
顯示具有 [C#基礎] 標籤的文章。 顯示所有文章

2013年8月31日 星期六

[C#基礎]-C#命令PC「關機 登出 休眠 重新開機」的語法收藏

[C#基礎]-C#命令PC「關機 登出 休眠 重新開機」的語法收藏


剛才爬文,發現有善心人事整理出C#命令PC「關機 登出 休眠 重新開機」的語法,馬上秉持C/P達人的精神趕緊收藏,有興趣的同好,歡迎來C/P一下 哈哈 ^ ^。


拷貝來源:http://xtony77.blogspot.tw/2011/07/c_6237.html


//關機
System.Diagnostics.Process.Start("C:\\WINDOWS\\system32\\shutdown.exe", "-f -s -t 0");

//登出
System.Diagnostics.Process.Start("C:\\WINDOWS\\system32\\shutdown.exe", "-l");

//休眠
System.Diagnostics.Process.Start("C:\\WINDOWS\\system32\\rundll32.exe","powrprof.dll,SetSuspendState");

//重新開機
System.Diagnostics.Process.Start("C:\\WINDOWS\\system32\\shutdown.exe", "-f -r -t 0");


[C#基礎]-C# While Loop 中 n++的擺放位置比較

[C#基礎]-C# While Loop 中 n++的擺放位置比較


2013年8月28日 星期三

[C#基礎]-C#實做九九乘法表

[C#基礎]-C#實做九九乘法表
本篇要分享C#實做C#實做九九乘法表範例,有興趣的同好,歡迎來一下哈哈 ^ ^。









using System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Text;
using
System.Threading.Tasks;

namespace
Console_Multiplication_Table
{

class
Program
{

static
void Pause()
{

Console.Write("Press any key to continue . . . ");
Console.ReadKey(true);
}

static
void Main(string[] args)
{

int
[,] A;
A = new int[2, 9];
int
i,j;
for
(i = 1; i < 10; i++)
{

A[0, i - 1] = i;
A[1, i - 1] = i;
}

for
(i = 0; i < 9; i++)
{

for
(j = 0; j < 9; j++)
{

Console.Write(A[0, i] + "X" + A[1, j] + "=" + (A[0, i] * A[1, j])+" ");
}

Console.WriteLine();
}

Pause();
}
}
}