»ìÄýÍÁÇ¿¶ÈÆÀ¶¨ÏµÍ³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
Ïà¹ØÎĵµ£º
ʱ³£ÔÚcppµÄ´úÂëÖ®Öп´µ½ÕâÑùµÄ´úÂë:
#ifdef __cplusplus
extern "C" {
#endif
//Ò»¶Î´úÂë
#ifdef __cplusplus
}
#endif
¡¡¡¡ÕâÑùµÄ´úÂëµ½µ×ÊÇʲôÒâ˼ÄØ£¿Ê×ÏÈ£¬__cplusplusÊÇcppÖеÄ×Ô¶¨Òåºê£¬ÄÇô¶¨ÒåÁËÕâ¸öºêµÄ»°±íʾÕâÊÇÒ ......
C³ÌÐòÊÇÓÉÒ»×é»òÊDZäÁ¿»òÊǺ¯ÊýµÄÍⲿ¶ÔÏó×é³ÉµÄ¡£ º¯ÊýÊÇÒ»¸ö×ÔÎÒ°üº¬µÄÍê³ÉÒ»¶¨Ïà¹Ø¹¦ÄܵÄÖ´ÐдúÂë¶Î¡£ÏÂÃæС±àºÍ´ó¼Ò·ÖÏíÏÂCÓïÑÔÖеĺ¯Êý¡£
1. initgraphº¯Êý
initgraphº¯ÊýÊdzõʼ»¯Í¼ÐÎϵͳ£¬ÆäÓ÷¨Îª£ºvoid far initgraph(int far *graphdriver, int far *graphmode,char far *pathtodriver); ³ÌÐòÀý×ÓÈçÏ£ ......
µÚÒ»ÖÖÀí½â
±ÈÈç˵ÄãÓÃC++¿ª·¢ÁËÒ»¸öDLL¿â£¬ÎªÁËÄܹ»ÈÃCÓïÑÔÒ²Äܹ»µ÷ÓÃÄãµÄDLLÊä³ö(Export)µÄº¯Êý£¬ÄãÐèÒªÓÃextern "C"À´Ç¿ÖƱàÒëÆ÷²»ÒªÐÞ¸ÄÄãµÄ
º¯ÊýÃû¡£
ͨ³££¬ÔÚCÓïÑÔµÄÍ·ÎļþÖо³£¿ÉÒÔ¿´µ½ÀàËÆÏÂÃæÕâÖÖÐÎʽµÄ´úÂ룺
#ifdef __cplusplus
extern "C" {
#endif
/**** some declaration or so *****/
#ifde ......
½ñÌìÎÞÊ£¬ÔÚÂÛ̳ÉÏÒ»Ö±¿´Ìù×Ó£¬ºÜÉÙ¶¯ÊÖʵ¼ù£¬½ñÌìÊÔ×ÅдÁËÒ»¸ö¶ÁÈ¡Ô´³ÌÐò´úÂëÐÐÊýµÄÀý×Ó£º
ÏÖÔڵĴúÂëÈçÏ£¬¿ÉÄÜ»¹Óв»ÍêÉƵĵط½£¬ÒÔºóÔٸĽø£º
#include <stdio.h>
#define CHARCOUNT 255
#define CON 6 /*µ¥ÐÐ×¢ÊÍ×îÉÙµÄʱºò*/
int realLength = 0;
/*
* function name: strCount
* function : count ......
C³ÌÐòÊÇÓÉÒ»×é»òÊDZäÁ¿»òÊǺ¯ÊýµÄÍⲿ¶ÔÏó×é³ÉµÄ¡£ º¯ÊýÊÇÒ»¸ö×ÔÎÒ°üº¬µÄÍê³ÉÒ»¶¨Ïà¹Ø¹¦ÄܵÄÖ´ÐдúÂë¶Î¡£ÏÂÃæС±àºÍ´ó¼Ò·ÖÏíÏÂCÓïÑÔÖеĺ¯Êý¡£
1. mallocº¯Êý
mallocº¯ÊýµÄ¹¦ÄÜÊÇÄÚ´æ·ÖÅ亯Êý£¬ÆäÓ÷¨Îª£ºvoid *malloc(unsigned size);³ÌÐòʵÀýÈçÏ£º
#include <stdio.h>
#i ......