![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_224,w_224)
C语言作业
C语言作业是大二上学期C语言学习的总结
Cachel wood
这个作者很懒,什么都没留下…
展开
-
C语言第16周作业(文件打开、关闭,读写)
1.2.3.4.5.6.3.4.7.8.9.原创 2020-12-28 23:40:16 · 276 阅读 · 0 评论 -
C语言第15周作业(枚举enum,函数指针,链表,宏)
1.16.(c)(e)正确。21.(a)enum {NUL,SOH,STX,ETX};NUL = 0,SOH = 1,STX = 2,ETX = 3.(b)enum {VT = 11,FF,CR}VT = 11, FF = 12, CR = 13(c)enum {SO = 14,SI,DLE,CAN = 24,EM}SO = 14,SI = 15,DLE = 16,CAN = 24,EM = 25(d)enum {ENQ = 45,ACK,BEL,LF = 37,ETB,ESC}ENQ原创 2020-12-22 14:43:25 · 340 阅读 · 0 评论 -
C语言第14周作业(结构体struct,联合union)
1.2.3.#include <stdio.h>struct { int hour; int minute;} time;int main(){ printf("enter a time:"); int hour,minute; scanf("%d:%d",&hour,&minute); if(minute==59){ minute = 00; if(hour==23){原创 2020-12-09 13:40:41 · 609 阅读 · 0 评论 -
C语言第13周作业(malloc函数,动态分配数组)
1.1.2.#include <stdio.h>#include <stdlib.h>#include <string.h>char *duplicate(const char*);int main(){ printf("enter a string:"); char s[100]; gets(s); puts(duplicate(s)); return 0;}char *duplicate(const ch原创 2020-12-03 22:15:57 · 1726 阅读 · 0 评论 -
C语言12周作业(指针与数组)
1.#include <stdio.h>#include <stdbool.h>#define ROW 3#define COLUMN 4bool search(int [ROW][COLUMN],int);int main(){ int temperatures[ROW][COLUMN]; int *s = &temperatures[0][0]; printf("enter %d numbers:",ROW*COLUMN);原创 2020-11-25 08:18:28 · 342 阅读 · 0 评论 -
C语言第11周作业(字符串和指针、数组)
1.4.#include <stdio.h>int main(){ char ch; while((ch=getchar())!='\n'){ printf("%0x\n",ch); } return 0;}5.#include <stdio.h>int main(){ char ch; while((ch=getchar())!='\n'){ if(ch==' '){原创 2020-11-17 20:29:33 · 1071 阅读 · 0 评论 -
C语言第10周作业(数组,变长数组,内存)
1.#include <stdio.h>int main(){ int price[10],quantity[10],amount[10]; int i,a,b; for(i=0;i<10;i++){ printf("enter two numbers:"); scanf("%d %d",&a,&b); price[i]=a; quantity[i]=b; amou原创 2020-11-10 20:55:24 · 320 阅读 · 0 评论 -
C语言第九周作业(指针变量,内存访问,取址,空指针)
1.3.(a)#include <stdio.h>int secs(int,int,int);int main(){ int h,m,s; printf("enter a time:"); scanf("%d:%d:%d",&h,&m,&s); printf("the seconds are %d",secs(h,m,s));}int secs(int h,int m,int s){ int total;原创 2020-11-03 23:53:10 · 399 阅读 · 0 评论 -
C语言第八周作业(局部变量,全局变量,递归)
1.2.2.3.5.15.3.1.(递归)#include <stdio.h>#include <time.h>int fib(int n);int main(){ int n; int tm; printf("enter a number:"); scanf("%d",&n); tm = time(NULL); printf("%d\n",fib(n-1)); tm =tim原创 2020-10-27 20:35:29 · 573 阅读 · 0 评论 -
C语言第七周作业(函数,随机数)
1.2.3.4.5.6.7.8.原创 2020-10-20 23:34:51 · 481 阅读 · 0 评论 -
C语言第六周作业(循环语句,逗号运算符)
第五周是咱们的国庆假期啦,所以理所当然的放了八天假期,第五周就这么停更啦!咱们来开始第六周的作业。1.#include <stdio.h>int main(){ int count,MAXCOUNT; float num, total; printf("\nplease type in the total number of data values to be added.\n\n"); count = 0; total = 0.0; s原创 2020-10-13 22:11:05 · 280 阅读 · 0 评论 -
C语言第四周作业(选择语句,if-else,switch-case,错误处理)
题目1a.#include <stdio.h>int main(){ int numYrs; printf("please input a number:"); scanf("%d",&numYrs); if (numYrs >5) printf("利率是 = 7.5%%"); else if (numYrs >0) printf("利率是 = 5.4%%"); else printf("error!");原创 2020-09-30 15:49:12 · 533 阅读 · 0 评论 -
c语言第三周作业(格式化输出,循环)
题目1简答题 #include <stdio.h> int main(){ float a=10.6; float b=13.10; float c=-3.42; printf("%d\n",(int)a); printf("%d\n",(int)b); printf("%d\n",(int)c); printf("%d\n",(int)(a+b)); printf("%f\n",(int)a+b+c); pri原创 2020-09-23 10:52:51 · 343 阅读 · 0 评论 -
c语言第二周作业(printf方法,char字符)
题目1 2(a)#include <stdio.h>int main(){ printf("Computers,computers everywhere as far as I can see,I really,really like these things, Oh joy,Oh joy for me!");return 0;}题目2#include <stdio.h>int main(){ printf("Part No. Price\n原创 2020-09-18 22:54:38 · 580 阅读 · 0 评论