1.启动和终止程序、显示运行中的程序列表
#include#include void hw0() { //启动计算器,记事本,查看系统进程 system("calc"); system("notepad"); system("tasklist"); } void hw1() { //进程终止 system("taskkill /f /im qq.exe"); }
2.显示一个变量的内存地址
void cr1()
{
int a = 10;
//printf("%p",&a)会显示变量的内存地址
printf("%p", &a);
system("pause");
}
3.在head文件中定义函数名称,使之可以使用中文编程
rvnhead.h
#include#include #include #define 返回值 void #define 分号 ; #define npd "notepad"
homework0.c
//因为在rvnhead.h中定义了void和;号,此文件中用中文代替也能编译运行
返回值 cr3()
{
printf("1.75sn")分号
system("pause")分号
}
4.字符、字符集、ASCII码与转义字符
#include#include void cr4() { int a = 5; while (a<10) { printf("a"); //转义字符,a即触发系统一次响铃 Sleep(3000); //等待3000ms,3000毫秒,即3秒,该函数位于Windows.h的头文件中 a++; } }
5.进制表示与进制转换
void cr5()
{
printf("%dn", 0x12); //0x开头的都是16进制
printf("%dn", 012); //0开头的都是8进制
//如何通过计算器验证计算是否正确:
//切换计算器到程序员模式
//10进制、2进制、16进制转10进制
//123 10 =1*10^2+2*10^1+3*10^0=100+20+3=123
//110 2 =1*2^2+1*2^1+0*2^0=4+2+0=6
//AB 16 =10*16^1+11*16^0=160+11=171
}



