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
Ïà¹ØÎĵµ£º
ÖÚËùÖÜÖª£¬strcmpΪ×Ö´®±È½ÏÖ»Ó㬼òµ¥µÄº¯Êý²¢²»¼òµ¥¡£
ÏÂÃæµÄ´úÂë
int main()
{
char* cp1 = {'z', 'h', 'a', 'n', 'g'};
char* cp2 = {'z', 'h', 'a', 'n', 'g'};
std::cout<<strcmp(cp1, cp2)<< ......
ÄÚ´æ¿ØÖÆƪ
calloc
free
getpagesize
malloc
mmap
munmap
calloc£¨ÅäÖÃÄÚ´æ¿Õ¼ä£©
Ïà¹Øº¯Êý
malloc£¬free£¬realloc£¬brk
±íÍ·Îļþ
#include <stdlib.h>
¶¨Ò庯Êý
void *calloc(size_t nmemb£¬size_t size);
º¯Êý˵Ã÷
calloc()ÓÃÀ´ÅäÖÃnmemb¸öÏàÁÚµÄÄڴ浥λ£¬Ã¿Ò»µ¥Î»µÄ´óСΪsize£¬²¢·µ»ØÖ¸ÏòµÚ ......
´î½¨eclipse C/C++¿ª·¢»·¾³£º
1¡¢ÏÂÔز¢°²×°Eclipse for C++£ºhttp://www.eclipse.org¡£×îаæÊÇ»ùÓÚEclipse 3.5 galileo£¬ÎļþÃûΪeclipse-cpp-galileo-SR1-win32.zip¡£É蹤×÷Ŀ¼ΪD:\workspace_cpp¡£
2¡¢eclipse for C/C++ IDEûÓаüº¬C/C++µÄ±àÒëÆ÷ºÍµ÷ÊÔÆ ......
Ç°ÃæһƪÎÒÃǽ²ÁËλÔËËãºó£¬»ù±¾CÓïÑԵĴó¿é¶¼Ìá¼°ÁË£¬Ò»Ð©Ï¸½ÚºÍÓ÷¨ÔÝʱ²»ÔÙ±¾Ä£¿é½éÉÜÁË¡£Ï£ÍûÎÒµÄÐÄÔ¸Äܹ»ÔÚÎÒ±Ïҵ֮ǰ¸øÎҵĴóѧÉúÑÄ»®ÉÏÒ»¸öÔ²ÂúµÄ¾äºÅ¡£¼ÓÓÍŬÁ¦¡£
ÔÚ±¾Ä£¿éµÄµÚÈýƪ¾ÍÒѾ½²ÁË»ù±¾µÄÊý¾ÝÀàÐÍ£¬ÆäÖаѸ¡µãÊý¿ÌÒâÁôÔÚÁ˺óÃæÀ´½éÉÜ¡£ÎÒµÄÀí½âÊÇÔÚÎÒÃÇÀí½âÁËÄڴ棬ָÕ룬λÔËËãµÈºó£¬ÔÙÀ´½éÉܸ¡µãÕâ¸öÌ ......