C语言
RabbitsAndCat
这个作者很懒,什么都没留下…
展开
-
小白入门中:TCPL习题4-1
4-1:编写函数strrindex(s,t),它返回字符串t在s中最右边出现的位置如果s中不包含t,则返回-1; int strindex(char s[] , char t[]) { int i , j , k , coordinate = -1; for(i = 0; s[i] != '\0'; i ++) { for(j = 0 , k = i; t[j] != '\0' &...原创 2020-05-12 16:36:20 · 295 阅读 · 0 评论 -
[C语言]文字版2048
/* 文字版2048 2020.5.6 by 小铭 */ #include <stdio.h> #include <windows.h> #include <string.h> #include <time.h> #include <stdlib.h> #define true 1 #define false 0 ...原创 2020-05-06 20:55:36 · 264 阅读 · 0 评论 -
小白入门中:TCPL习题3-1——3-6
在上面二分法查找的例子中,while循环语句内共执行了两次测试,其实一次就足够。重写该函数,使得在内部只执行一次测试,比较两种的运行时间 int binsearch(int x , int v[] , int n) { int low , high , mid; low = 0 ; high = n - 1; while (low <= high ) { mid = (low ...原创 2020-05-02 17:51:53 · 291 阅读 · 0 评论 -
小白入门中:TCPL习题2-1——2-10
2-1:编写程序确认signed和unsigned限定的char、short、int与long类型变量的取值范围。采用打印标准头文件中的限定值或直接计算。 #include <stdio.h> #include <limits.h> #include <iostream> int main() { printf("打印signed与unsiged限定的变量...原创 2020-04-30 00:47:14 · 342 阅读 · 0 评论 -
小白重学中:位运算符
参考文章 link & //按位与(AND) | //按位或(OR) ~ //按位非 ^ //按位异或(XOR) >> //右移 << //左移 >>> //无符号右移原创 2020-04-28 22:21:42 · 147 阅读 · 0 评论 -
小白入门:TCPL习题1-6 —— 1-22
1-6:验证表达式getchar() != EOF 的值是0 还是 1; #include <iostream> #include <stdio.h> using namespace std; int main() { int c ; while(c = getchar() != EOF); { printf("%d\n" , c); } printf("%...原创 2020-04-21 09:49:17 · 237 阅读 · 0 评论