Linux下完成的一个作业程序
文档创建日期:2010-02-18
01 // P173: 2.编程题 (5)输入一个字符串,统计英文字母、空格、数字和其他字符的个数。
02
03 // The beginning of C program: test06-05.c.
04
05 // Header files included.
06 #include <stdio.h>
07 #include <string.h>
08
09 // Macro definition.
10 #define MAX_SIZE 100
11
12 // Main function's declaration.
13 int main ( void )
14 {
15 char ch[MAX_SIZE];
16 int letter=0, space=0, number=0, other=0, i=0, length=0;
17 printf ( "Please input a line of characters: " );
18 do
19 {
20 ch[i] = getchar();
21 i++;
22 } while ( ch[i-1] != '\n' );
23 length = i-1;
24 ch[length] = '\0';
25 printf ( "The string length is: %d\n", strlen(ch) );
26 &nbs
相关文档:
原来由于学习工作的需要,在XP下装了LINUX系统,安装XP/LINUX双系统麻烦,没想到卸载也麻烦。刚开始以为把装LINUX系统的那个盘格式化就OK了,结果重启后仍然出现那个可恨的grub引导界面。一气之下,重装C盘,grub界面没了,可却进不了系统。网上多方查找,最后解决办法:下载mbrfix文件到u盘,用系统盘进入到WINPE,将mbrfi ......
GDB是GNU开源组织发布的一个强大的UNIX下的程序调试工具。或许,各位比较喜欢那种图形
界面方式的,像VC、BCB等IDE的调试,但如果你是在UNIX平台下做软件,你会发现GDB这个
调试工具有比VC、BCB的图形化调试器更强大的功能。所谓“寸有所长,尺有所短”就是这
个道理。
一 ......
#
# 这段代码被连接到system模块的最前面,这也是它为什么称之为head.s的原因。
# 从这里开始内核完全运行在保护模式下。head.s采用的是at&t格式的
# 汇编。注意的是代码中的赋值方向是从左到右。
#
# 这段程序实际上是出于内存的绝对地址0开始处。首先是加载各个数据段寄存器。
# 重新设置全局描述符表g ......
/*
* linux/fs/fcntl.c
*
* (C) 1991 Linus Torvalds
*/
#include <string.h>
#include <errno.h>
#include <linux/sched.h>
#include <linux/kernel.h>
#include <asm/segment.h>
#include <fcntl.h>
#include <sys/stat. ......
/*
* linux/fs/inode.c
*
* (C) 1991 Linus Torvalds
*/
#include <string.h>
#include <sys/stat.h> // 文件状态头文件
#include <linux/sched.h>
#include <linux/kernel.h>
#include <linux/mm.h>
#include <asm/system.h>
......