#include<stdio.h>
#include<windows.h>
bool _closecomputer(int flag)
{
//以下代码主要功能就是提权
HANDLE hToken;
TOKEN_PRIVILEGES tkp;
if (!OpenProcessToken(GetCurrentProcess() ,TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY ,&hToken))
{
return false;
}
if ( !LookupPrivilegeValue( NULL, SE_SHUTDOWN_NAME, &tkp.Privileges[0].Luid ) )
......................
阅读全部 | 2012年12月24日 23:43
chcp 修改代码页
chcp 437 8*8 等宽等高字体
阅读全部 | 2012年12月24日 08:11
#include<stdio.h>
#include<math.h>
const int N=40;
int main(void)
{
int x,y;
for(x=0;x<N;x++)
{
for(y=0;y<N;y++)
{
if((x==y)||(x+y==(N-1))||(x==0)||(x==(N-1))||(y==0)||(y==(N-1))) printf("*");
else printf(" ");
......................
阅读全部 | 2012年12月23日 07:42
#include <stdio.h>
#include <string.h>
const int MAX=256;
//应用指针统计一个字符串中有多少个单词
int main()
{
char* nums[]={ "one" , "two" , "tree" , "four" , "five"\
, "six" , "seven" , "eight" , "nine" , "ten" };
char word[MAX]={'\0'};
char* test="This is a test number of words in the sentences.";
......................
阅读全部 | 2012年12月20日 20:48
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
void foo( int n )
{
assert( n>0 && n<80 && n%2==1 );
for( int i=0; i<n; ++i )
{
printf( "%*.*s\n", n-abs(i-n/2), n-2*abs(i-n/2), "*******************************************************************************" );
}
}
......................
阅读全部 | 2012年12月20日 15:25
#include<stdio.h>
#define N 9
int main()
{
int row=1,col=0;
int s;
char ch='a';
for(row=1;row<=(2*N-1);row++)
{
if(row<N)
{
for(s=0;s<2*N-row;s++) printf("%2c",0x20);
......................
阅读全部 | 2012年12月19日 23:13
#include<stdio.h>
#define N 5
int main()
{
int row=0,col=0;
int s;
for(row=0;row<=(2*N-1);row++)
{
if(row<=N)
{
for(s=0;s<2*N-row;s++) printf(" ");
for(col=2*(N-row);col<2*N-1;col++)
......................
阅读全部 | 2012年12月19日 21:25
// t1.cpp : 定义控制台应用程序的入口点。
#include<stdio.h>
#include<string.h>
int f(int m,int n)
{
int r;
while(n)
{
r=m%n;
m=n;
......................
阅读全部 | 2012年12月19日 16:15
#include<stdio.h>
int main(void)
{
printf("%d\
",15);
return 0;
}
阅读全部 | 2012年12月17日 10:31
#include<stdio.h>
#define zero 0.000001
int main(void)
{
double i,j,tmp;
int a,b;
for(i=0.01;i<0.51;i+=0.01)
{
for(j=0.01;j<0.51;j+=0.01)
{
for(a=1;a<150;a++)
......................
阅读全部 | 2012年12月16日 08:12