混凝土强度评定系统1.1 c代码
#define NULL 0
#define LEN 10
#define OK printf("\n此组数据合格。\n")
#define NO printf("\n此组数据不合格!\n")
#define CN printf("\n%30c 伟成工作室荣誉出品 %c\n",17,16)
#include "stdlib.h"
#include "math.h"
static float min,ave;
float *zwfloat(void)
{
float *array,value;
int size,count;
size=LEN;
array=malloc((size+1)*sizeof(float));
if (array==NULL) return NULL;
count=0;
while (scanf("%f",&value),value!=0)
{
if(value<0) continue;
count+=1;
if (count>size)
{
size+=LEN;
array=realloc(array,(size+1)*sizeof(float));
if (array==NULL) return NULL;
}
array[count]=value;
}
if (count<size)
{
array=realloc(array,(count+1)*sizeof(float));
if (array==NULL) return NULL;
}
array[0]=count;
return array;
}
float stdev(float const *p)
{
int i;
float sm=0.0;
ave=0.0;min=p[1];
if (p==NULL) return 0;
for
相关文档:
C程序是由一组或是变量或是函数的外部对象组成的。 函数是一个自我包含的完成一定相关功能的执行代码段。下面小编和大家分享下C语言中的函数。
1. fclose函数
fclose函数的功能是关闭一个流,其用法是:int fclose(FILE *stream); 程序例子如下:
#include <string.h& ......
C程序是由一组或是变量或是函数的外部对象组成的。 函数是一个自我包含的完成一定相关功能的执行代码段。下面小编和大家分享下C语言中的函数。
1. kbhit函数
kbhit函数是检查当前按下的键,其用法为:int kbhit(void);程序例子如下:
#include <conio.h>
int main(void)
{
c ......
第一种理解
比如说你用C++开发了一个DLL库,为了能够让C语言也能够调用你的DLL输出(Export)的函数,你需要用extern "C"来强制编译器不要修改你的
函数名。
通常,在C语言的头文件中经常可以看到类似下面这种形式的代码:
#ifdef __cplusplus
extern "C" {
#endif
/**** some declaration or so *****/
#ifde ......
5、#define宏定义。宏只是简单的文本替换,很容易引起歧义。
#include <stdio.h>
#define CONS(a,b) (int)(a##e##b)
#define STR(s) #s
int main()
{
printf(STR(vck));
printf("\n");
printf("%d\n",CONS(2,3));
return 0; ......
用函数access,头文件是io.h,原型:
int access(const char *filename, int amode);
amode参数为0时表示检查文件的存在性,如果文件存在,返回0,不存在,返回-1。
这个函数还可以检查其它文件属性:
06 &nbs ......