cµÄÒ»¸öСÎÊÌâ
/*±àд³ÌÐò£¬ÊäÈë2¸öÊýÒÔ¼°¼Ó¼õ³Ë³ýÖеÄijÔËËã·ûºÅ£¬²¢µ÷ÓÃ×Ô¼º±àдµÄº¯Êý¼ÆËãÏàÓ¦µÄ½á¹û*/
#include<stdio.h>
#include<conio.h>
float cal(int a,char sym,int b);
main()
{
int a=0,b=0;
char sym='\0';
float c=0.0;
scanf("%d%c%d",&a,&sym,&b);
c=cal(a,sym,b);
printf("%d%c%d=%f\n",a,sym,b);
getch();
}
float cal(int a,char sym,int b)
{
float c=0.0;
switch(sym)
{
case '+': c=a+b;
case '-': c=a-b;
case '*': c=a*b;
case '/': if(b!=0)
{
c=(float)a/b;
return c;
}
else
{
printf("Devided by 0.\n");
exit(0); /*±àÒëµÄʱºòÔÚÕâÐгö´í*/
&n
Ïà¹ØÎĵµ£º
void myprintf(const char *format, ...)
{
va_list arglist;
va_start(arglist, format);
vprintf(format, arglist); // or some other operation
va_end(arglist);
}
NAME
printf, fprintf, sprintf, snprintf, vprintf, vfprintf, vsprintf, vsnprintf - formatt ......
×Ö·û´®×ª»»Æª
atof
atoi
atol
gcvt
strtod
strtol
strtoul
toascii
tolower
toupper
atof£¨½«×Ö·û´®×ª»»³É¸¡µãÐÍÊý£©
Ïà¹Øº¯Êý
atoi£¬atol£¬strtod£¬strtol£¬strtoul
±íÍ·Îļþ
#include <stdlib.h>
¶¨Ò庯Êý
double atof(const char *nptr);
º¯Êý˵Ã÷
atof()»áɨÃè²ÎÊýnptr×Ö·û´®£¬Ìø¹ýÇ°Ãæµ ......
C×Ö·û´®´¦Àíº¯ÊýµÄʵÏÖ£¨Linux£©
#include <stddef.h>
char * ___strtok = NULL;
char * strcpy(char * dest,const char *src)
{
char *tmp = dest;
while ((*dest++ = *src++) != '\0')
/* nothing */;
return tmp;
}
char * strncpy(char * des ......
²ÉÓÃ×¢Èëµ½ÆäËû½ø³ÌµÄ·½·¨À´Òþ²Ø×Ô¼ºµÄ½ø³Ì¡£¾ÍÊÇ˵£¬°ÑÄãÏë×öµÄÊÂÇé¼ÄÉúµ½±ðÈ˵Ľø³ÌÀïÃæ¡£±ÈÈçIEʲôµÄ¡£¹ØÓÚ×¢ÈëµÄ·½·¨ºÜ¶à£¬ÏÂÃæÎÒ¸øÄãÒ»¸öDLL×¢ÈëµÄ·½·¨£¬Õâ¸öÊÇÎÒ×öijÍâ¹ÒʱÓùýµÄ´úÂ룬Äã²Î¿¼Ò»Ï°ѡ£
int APIENTRY _tWinMain( HINSTANCE hInstance,
  ......
C¡¢´«Í³ C++
#include <assert.h>¡¡¡¡¡¡¡¡//É趨²åÈëµã
#include <ctype.h>¡¡¡¡¡¡¡¡ //×Ö·û´¦Àí
#include <errno.h>¡¡¡¡¡¡¡¡ //¶¨Òå´íÎóÂë
#include <float.h>¡¡¡¡¡¡¡¡ //¸¡µãÊý´¦Àí
#include <fstream.h>¡¡¡¡¡¡ //ÎļþÊäÈ룯Êä³ö
#include <iomanip.h>¡¡¡¡¡¡ //²ÎÊý»¯ÊäÈ룯Êä³ ......