#include <stdioh>
#include <stringh>
#include <malloch>
#include <asserth>
#define MAX_NUM_WORDS_PER_PARAGRAPH 1024 /每段字数最多1024/
#define MAX_NUM_PARAGRAPH 100 /段落数最多100/
#define debug_suspend 0
#define IS_INTERPUNCTION(ch)\
((ch) == '' || (ch) == ',' || (ch) == '\'' || (ch) == '' || (ch) == ';' || (ch) == ':' || (ch) == '\"' || (ch) == '!' ||\
(ch) == '{' || (ch) == '}' || (ch) == '(' || (ch) == ')' || (ch) == '[' || (ch) == ']' ||\
(ch) == '@' || (ch) == '#' || (ch) == '$' || (ch) == '%' || (ch) == '&' || (ch) == '')
/从终端输入得到一篇英文文章, 并且检查文章合法性,不然挂起/
int get_a_paragraph(char artc)
{
char ch = 0;
char pt = NULL;
int is_pa = 0;
int have1end_token = 0;
unsigned int num_paras = 0;
unsigned int num_letter_per_par = 0;
if(artc == NULL)
{
return 0;
}
artc = (char)malloc((1024 + 1) 100);
if(artc == NULL)
{
return 0;
}
memset(artc, 0, (1024 + 1) 100);
pt = artc;
while(1)
{
ch = getchar();
if(ch >= 'a' && ch <= 'z'
|| ch >= 'A' && ch <= 'Z'
|| ch == ' '
|| ch == '\n'
|| ch == '#'
|| IS_INTERPUNCTION(ch))/可以是标点符号/
{
if(ch == '#')
{
if(have1end_token == 0)
{
have1end_token = 1;
continue;
}
else
{
return 1;/文章输入结束/
}
}
have1end_token = 0;
if(ch == '\n')
{
if(is_pa == 0)
{
is_pa = 1;
/保证最大段落数/
if(num_paras >= 100)
{
#if debug_suspend
assert(0);
#endif
return 2;
}
/保证每段最大字符数/
if(num_letter_per_par > 1024)
{
#if debug_suspend
assert(0);
#endif
return 2;
}
pt = ch;
pt++;
num_paras ++;
num_letter_per_par = 0;
continue;
}
else if(is_pa == 1)
{
continue;
}
}
is_pa = 0;
if(num_letter_per_par > 1024)
{
#if debug_suspend
assert(0);
#endif
return 2;
}
pt = ch;
pt++;
num_letter_per_par ++;
}
else
{
have1end_token = 0;
is_pa = 0;
printf("you have input invalid character!\n"); /出错,非法字符,应该要挂起/
#if debug_suspend
assert(0);
#endif
continue;/忽略非法字符/
}
}
return 1;
}
/每个段落的存放结构/
struct stats
{
unsigned int num_bytes;/字数/
unsigned int num_words;/单词数/
};
/解析这篇英文, 并且打印结果/
void parse_english_article(char artc)
{
unsigned int num_paras = 0;
int space = 0;
unsigned int para_begin = 0;
struct stats para_statistic[100] = {{0}};
char pt = NULL;
int i = 0;
int new_line = 0;
if(artc == NULL)
{
return;
}
pt = artc;
while(pt == '\n')
{
pt++;
}
if(pt != '\0')
{
num_paras = 1;
}
space = 1;
while(pt != 0)
{
if(pt != '\n')
{
if(new_line == 1)
{
new_line = 0;
num_paras ++;
if(pt != ' ')
{
para_statistic[num_paras - 1]num_words = 1;
}
}
if(pt == ' ')
{
space = 1;
}
para_statistic[num_paras - 1]num_bytes++;
if(space == 1 && pt != ' ')
{
para_statistic[num_paras - 1]num_words++;
space = 0;
}
}
else
{
if(new_line == 0)
{
new_line = 1;
}
}
pt++;
}
/打印结果/
printf("\ntotal paragraph num: %u\n", num_paras);
for(i = 0; i < num_paras; i++)
{
printf("para %4u#> total words: %5u total bytes: %5u\n",
i,
para_statistic[i]num_words,
para_statistic[i]num_bytes);
}
free(artc);
}
void main()
{
char article;
int rtn = 0;
rtn = get_a_paragraph(&article);
if(rtn != 0)
{
parse_english_article(article);
}
}
debug的意思:
①排除故障,排除错误;
②调整程序,移去程序中的错误;
③除害虫,除去建筑物内的窃听器。
程序故障统称为“臭虫(BUG)”,把排除程序故障叫DEBUG,而这奇怪的“称呼”,成为后来计算机领域的专业行话。
如DOS系统中的调试程序,程序名称就叫DEBUG。DEBUG在windows系统中也是极其重要的编译 *** 作。
扩展资料DEBUG是一种计算机程序。马克2号(Harvard Mark II)编制程序的葛丽丝·霍波(Grace Hopper)是一位美国海军准将及计算机科学家,同时也是世界最早的一批程序设计师之一。
如DOS系统中的调试程序,程序名称就叫DEBUG。DEBUG在windows系统中也是极其重要的编译 *** 作。
参考资料:
请看以下例子
Commissioning Engineers 调试工程师
Guidebook to Commissioning and Trial Production
调试与试生产指导手册
Certificate of Commissioning
调试 证明
Upon completion of commissioning, the buyer shall conduct the trial production for 2 months under the technical advice and supervision of the experts from the seller
在调试完成后,买方应在卖方专家的技术指导和监督下进行为期两个月的试生产。
也 可以 使用 adjustment
After the product has been sold, we will send specialist to guide theinstallation free of charge, and assist the installation unit in performing adjustment
产品出厂后由公司指派专业人员免费进行指导安装,同时可免费协助安装单位进行设备调试
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)