操作系统分为两类 :
非实时操作系统:
Windows 1ms 不等分 0.5 for word procedure , 0.3 for mp3 , 0.2 for painting according to previledge
linux 塞班 民用方面
实时操作系统(RTOS)
微内核 代码很少 vx work(美国) QNX Itron(日本 (微内核, 代码很少)) MCOSII(教学用) 军事方面 优先级高的先运行 1ms for the whole task 硬件中断(立即对外部事件响应特别快)
Application
Middleware
Driver
Main 不是关键字,sizeof是关键字
C语言不允许以数字开头
#include <stdio.h>
#define NB "12"
int main(void)
{
char a[3] = "12";
int b = (int)a;
int c = (int)"12";
printf("%d\n%d", c, b);
}
#include <stdio.h>
#include <string.h>
#define N 10
typedef struct Student
{
char stuId[N];
char name[N];
int gender;
unsigned short age;
unsigned int scores;
} student;
int main(void)
{
student stu = {"20093287", "ying", 0, 19, 100};
printf ("%s\t%s\t%s\t%d\t%d\n",
stu.stuId, stu.name, stu.gender?"female":"male", stu.age, stu.scores);
strcpy (stu.name, "yun");
printf ("%s\t%s\t%s\t%d\t%d\n",
stu.stuId, stu.name, stu.gender?"female":"male", stu.age, stu.scores);
return 0;
}
#include <stdio.h>
#include <windows.h>
#include <conio.h>
enum sound
{
a = 262, b = 294, c = 330, d = 349,
e = 392, f = 440, g = 494
}var;
int main(void)
{
while (1)
{
switch(getch())
{
case '1':
Beep(a, 100);
break;
case '2':
Beep(b, 100);
break;
case '3':
Beep(c, 100);
break;
case '4':
Beep(d, 100);
break;
case '5':
Beep(e, 100);
break;
case '6':
Beep(f, 100);
break;
default:
break;
}
}
return 0;
}
#include <stdio.h>
int main()
{
int *p ;
int a = 0x12345678;
char *pa = (char *)&a;
for (int i = 0; i < 4; i++)
{
printf ("%x---%x\n", pa+i, pa[i]);
}
printf ("1\01");
return 0;
}
#include <stdio.h>
#include <string.h>
#define N 100
int encrypt(char *, char *);
int main()
{
char source[N];
char dest[N];
scanf("%s", source);
encrypt(source, dest);
dest[strlen(source)] = '\0';
printf(dest);
return 0;
}
int encrypt (char source[], char dest[])
{
int length = strlen(source);
int i = 0;
for (i = 0; i < length; i++)
{
if (source[i] > 'z' || source[i] < 'A')
{
dest[i] = source[i];
continue;
}
if (dest[i] >= 'w')
{
dest[i] = dest[i]-'w'+'a';
continue;
}
else if (dest[i] <= 'Z')
{
if (dest[i] >= 'W')
{
dest[i] = dest[i]-'W'+'A';
}
}
dest[i] = source[i]+4;
}
return 1;
}
课堂笔记一
最新推荐文章于 2024-02-08 14:58:00 发布