浙大版C程实验
Cathy1122334455
这个作者很懒,什么都没留下…
展开
-
16. 编写程序,使其具有以下功能: (1) 创建一个能够记录6个任意整数的单向链表。要求:这6个整数必须从键盘获得,并分别保存在链表的不同节点中。 (2) 使用循环语句,遍历已经创建完成的链表,求
#include <stdio.h>#include <stdlib.h>#include <bits/stdc++.h>using namespace std;typedef struct ListNode{ int data; ListNode *next;}ListNode;int main(){ #ifdef ONLINE_JU...原创 2019-01-03 21:45:26 · 1276 阅读 · 0 评论 -
15. 编写一个函数mysum,其功能是计算n个整数中数值在70~80之间(含70和80)的整数的和,主函数程序的功能是从键盘输入8个整数,通过调用函数mysum计算这8个整数中数值在70~80之间的
#include <stdio.h>int mysum(int a[], int b);int main(){ #ifdef ONLINE_JUDGE #else freopen("in.txt", "r", stdin); #endif int a[8]; for(int i = 0; i < 8; i++){ scanf("%d", &am...原创 2019-01-03 21:54:53 · 3459 阅读 · 0 评论 -
14.编写一个名为countc函数(函数头为:int countc(char array[])),其功能是:统计array数组中所存放的字符串中大写字母的数目,并返回字符串中大写字母的数目。再编写一个
#include <stdio.h>int countc(char array[]);int main(){ #ifdef ONLINE_JUDGE #else freopen("in.txt", "r", stdin); #endif int count; char array[80]; gets(array); count = countc(arr...原创 2019-01-03 22:07:46 · 2560 阅读 · 0 评论 -
13. 编写程序,使其具有以下功能: (1) 定义一个用来表示商品信息的结构体类型shangpin,该结构体包含三个成员,分别为spid、spname和spdj,其中spid表示商品号,类型为字符数
#include <stdio.h>#include <stdlib.h> typedef struct shangpin{ char spid[7]; char spname[15]; float spdj;}shangpin;int main(){ shangpin w; FILE *fp; gets(w.spid); gets(w.sp...原创 2019-01-04 10:40:37 · 3771 阅读 · 0 评论 -
12.编写程序,其功能是从键盘输入n*n个整型数(n≤20),组成n行n列数组,打印出其上三角数组。
#include <stdio.h>int main(){ int Matrix[20][20]; int size; int i, j; scanf("%d", &size); for(i = 0; i < size; i++){ for(j = 0; j < size; j++){ scanf("%d", &Matrix[i...原创 2019-01-04 11:32:41 · 2301 阅读 · 0 评论