#include<stdio.h>main( ){ FILE *fp; int i; struct rec{ /*定义结构体类型*/ char id[10]; char name[15]; char department[15]; }record; printf("***********************************************************\n"); printf("** This program is to show the block file input &...
#include<stdio.h> main(){ FILE *fp; int i; struct rec{ char id[10]; char name[15]; char department[15]; }record; printf("****************************************\n"); printf("This program is to show the format file input & output\n"); printf("********************...
#include<stdio.h>#include<stdlib.h>#define NUM 3main (){ FILE *fp1; char *temp; int i,j; struct rec{ char id[10]; char name[15]; char department[15]; }record[NUM]; printf("This programis to show the random file input & out put \n"); if((fp1=fopen("f:\\infile.txt","wb...
一辆卡车欲穿越过1000km的沙漠,卡车耗油为1L/km,卡车总载油能力为500L。显然卡车一次是过不了沙漠的,司机必须设法在沿途设立几个储油点,使卡车能顺利穿越沙漠。试问司机如何建立这些储油点?每一储油点应存多少油,才能使卡车以消耗最少油的代价通过沙漠?#include<stdio.h>#define MAX 32void main(){ int k,i; float wdistance; float storedOil[MAX]; float distance[MAX]; puts("********************************"); puts(" ...
#include <stdlib.h>#include <stdio.h> #define MAX_VEXTEX_NUM 9 /* 图中顶点数 */#define ARC_NUM 12 /* 图中弧数 */#define MAX_QUEUEMEM (MAX_VEXTEX_NUM+1)/* 定义描述图的顶点之间连接信息的数组 */int GraphEdge[ARC_NUM * 2][2] = {{0,1},{1,0},{1,2},{2,1},{2,3},{3,2},{3,4},{4,3},{4,5},{5,4},{5,0},{0,5},{0,6},{6,0},{6,8},{8,...
#include<stdio.h>/*定义待排序数组的最大长度*/#define MAX 100/*———————————————————————直接插入排序——————————————————————————*/void InsertSort(int *R,int n){ /* 对数组R中的元素R[1]..R[n-1]按递增序进行插入排序*/ int i,j; /*空出哨位R[0]*/ for(i=n;i>=1;i--) R[i]=R[i-1]; /* 依次插入R[2],…,R[n] */ for(i=2;i<=n;i...