2013年8月19日

统计字数的小程序(1)

摘要: 读取输入的的字符并报告其中的字符、单词以及行数。c primer plus 7.7 1 #include 2 #include 3 #include 4 #define STOP ']' 5 int main(void) 6 { char c; 7 int n_character=0; 8 int n_word= 0; 9 int n_line = 0;10 int p_line = 0;11 bool inword = false;12 char prev ;13 printf("Please enter the strings ... 阅读全文

posted @ 2013-08-19 21:10 イケメンおっさん_汪汪 阅读(987) 评论(0) 推荐(0) 编辑

求素数

摘要: 质数又称素数。指在一个大于1的自然数中,除了1和此整数自身外,没法被其他自然数整除的数。换句话说,只有两个正因数(1和自己)的自然数即为素数。最小的素数是2, 它也是唯一的偶素数。比1大但不是素数的数称为合数。1和0既非素数也非合数。c prime plus 第七章 7.5程序(这个程序吧1判断为素数,但是1不是哦) 1 // divisors.c -- nested ifs display divisors of a number 2 #include 3 #include 4 int main(void) 5 { 6 unsigned long num; /... 阅读全文

posted @ 2013-08-19 19:45 イケメンおっさん_汪汪 阅读(235) 评论(0) 推荐(0) 编辑

导航