
C程序设计语言课后习题
qq_33528164
爱好共享,提倡互相帮助。
展开
-
第三章
3.1#include <stdio.h>int binarySearch_1(int n[], int number, int d);int binarySearch_2(int n[], int number, int d);int main(){ int n[] = {1,5,2,8,10,56,24,11,7}; int result = binar...原创 2019-02-22 14:49:25 · 283 阅读 · 0 评论 -
4.12~4.14
4.12void reverse(char str[], int before, int behind){ int c; if(before &lt; behind){ c = str[before]; str[before] = str[behind]; str[behind] = c; reverse(str, ...原创 2019-02-24 09:40:36 · 252 阅读 · 0 评论 -
第一章8~12
1.8#include &amp;amp;lt;stdio.h&amp;amp;gt;int main(){ int c; int space = 0; int tab = 0; int nextline = 0; while((c=getchar())!=EOF){ switch(c){ case ' ': s...原创 2019-02-20 09:41:55 · 2137 阅读 · 0 评论 -
2.3~2.5
2.3#include &lt;stdio.h&gt;int htoi(char s[]){ int result = 0; while(*s){ switch(*s){ case 'A': case 'a': result = result * 16 + 10; ...原创 2019-02-20 11:47:05 · 204 阅读 · 0 评论 -
第一章例子
统计各个数字、空白字符、以及其他字符出现的次数#include <stdio.h>int main(){ int c, i, nwhite, nother; int ndigit[10]; nwhite = nother = 0; for(i = 0; i < 10; ++i){ ndigit = 0; } ...原创 2019-02-21 08:10:58 · 167 阅读 · 0 评论 -
第一章16~19
1.16#include <stdio.h>#define MAXLINE 1000 /*maximum input line size*/int getlines(char line[], int maxline);void copy(char to[], char from[]);/* print longest input line*/int main(){ ...原创 2019-02-21 09:11:49 · 165 阅读 · 0 评论