(c primer plusµÚÎå°æ) ѧϰ±Ê¼Ç
µÚ¶þÕ cÓïÑÔ¸ÅÊö
Ò»¸ö¼òµ¥µÄʵÀý
#include <stdio.h>
int main(void)
{
int num; /*¶¨Òå±äÁ¿num*/
num = 1; /*¸ø±äÁ¿num¸³Öµ*/
printf("I am a simple"); /*ʹÓÃprintf()º¯Êý*/
printf("computer.\n");
printf("My favorite number is %d because it is first.\n",num);
return 0;
}
¼òµ¥·ÖÎöÈçÏ£º
µÚÒ»¸öÓï¾ä£º#include<stdio.h> ¸æËß±àÒëÆ÷±¾Ô´Îļþ°üº¬stdio.hÖеÄËùÓÐÐÅÏ¢°üº¬º¯Êý¡¢±äÁ¿µÈ
µÚ¶þ¸öÓï¾ä£ºint main(void) ¶¨Òåmainº¯ÊýÀàÐÍΪint,²»½ÓÊÜÈκβÎÊý(void)
µÚÈýºÍµÚËĸöÓï¾ä£º¶¨ÒåÁËintÀàÐͱäÁ¿num£¬²¢¸³Öµ¸ønum
µÚÎå¡¢ÁùºÍÆßÓï¾ä£ºµ÷ÓÃÁËstdio.hÎļþÖеÄprintf()º¯Êý
µÚÁù¸öÓï¾ä£º·µ»ØÓï¾ä£¬·µ»ØÖµÎª0
ÉîÈë·ÖÎö£º
µÚÒ»£º#includeÊÇcÓïÑÔµÄÔ¤´¦ÀíÆ÷Ö¸Áî(preprocessor directive),c±à¼Æ÷ÔÚ±àÒëǰҪ¶ÔÔ´´úÂë×öһЩ׼±¸¹¤×÷£¬Õâ³ÆÎªÔ¤´¦Àí
µÚ¶þ£ºint main()º¯Êý£¬¼¸ºõËùÓеÄc³ÌÐò¶¼ÊÇ´ÓÕâ¸öº¯Êý¿ªÊ¼Ö´Ðеģ¬main()ÊÇc³ÌÐòµÄ»ù±¾Ä£¿é , ¶øintÔòÉùÃ÷º¯Êý·µ»ØµÄÊÇÕûÊý£¬·µ»Ø¸ø²Ù×÷ϵͳ£¬ÆäËûÉùÃ÷mainµÄÐÎʽ£º
main() /* c90±ê×¼»áÖ§³ÖÕâÖÖÐÎʽ£¬c99Ôò²»Ö§³Ö£¬×îºÃ²»ÒªÕâÑùÉùÃ÷*/
Void main() /*ÎÞ·µ»ØÖµ£¬×îºÃÒ²²»ÒªÕâÑùÉùÃ÷ */
µÚÈý£ºint num ¶¨ÒåÁËÕûÐͱäÁ¿num£¬ÔÚc³ÌÐòÖÐ,ËùÓбäÁ¿ÔÚʹÓÃ֮ǰ±ØÐ붨Òå¶øÇÒ±ØÐë¸ø³öÀàÐÍ£¬²»È»±àÒëÆ÷ͨ²»¹ý£¬»áÌáʾ±àÒë´íÎó
µÚËÄ£ºµ÷ÓÃÁËcÓïÑÔ±ê×¼º¯Êýprintf()£¬ÆäÖÐÀ¨ºÅÀïÃæµÄÊDzÎÊý£¬µ±³ÌÐòµ÷ÓÃÁËprintf()º¯Êý£¬½«¿ØÖÆÈ¨½»¸øprinft()º¯Êý£¬µ±Íê³Éµ÷ÓÃÁË£¬¾Í½«¿ØÖÆÈ¨½»¸ømain()º¯Êý
×îºóÒ»¸öÓï¾ä£ºreturn 0;ÒòΪmainº¯ÊýÊÇÕûÊýÀàÐÍ£¬ËùÒÔ±ØÐë·µ»ØÒ»¸öÕûÊýÀàÐ͵ÄÖµ£¬Ã»Óиø³ö·µ»ØÓï¾ä£¬Ïà¶Ôc99±ê×¼À´Ëµ±àÒëÆ÷»áÌáʾ±àÒë´íÎó
Ïà¹ØÎĵµ£º
ÔÚANSI±ê×¼»¯ºó£¬CÓïÑԵıê×¼ÔÚÒ»¶ÎÏ൱µÄʱ¼äÄÚ¶¼±£³Ö²»±ä£¬¾¡¹ÜC++¼ÌÐøÔڸĽø¡££¨Êµ¼ÊÉÏ£¬Normative Amendment1ÔÚ1995ÄêÒѾ¿ª·¢ÁËÒ»¸öеÄCÓïÑÔ°æ±¾¡£µ«ÊÇÕâ¸ö°æ±¾ºÜÉÙΪÈËËùÖª¡££©±ê×¼ÔÚ90Äê´ú²Å¾ÀúÁ˸Ľø£¬Õâ¾ÍÊÇISO9899:1999£¨1999Äê³ö°æ£©¡£Õâ¸ö°æ±¾¾ÍÊÇͨ³£Ìá¼°µÄC99¡£Ëü±»ANSIÓÚ2000ÄêÈýÔ²ÉÓá£
¡¡¡¡ÔÚC99ÖаüÀ ......
CºÍC++±à³ÌºÍѧϰÎĵµ
1 :Ö¸Õë±äÁ¿Ãû³ÆÒÔpΪÊ××Ö·û£¬ÕâÊdzÌÐòԱͨ³£ÔÚ¶¨ÒåÖ¸ÕëʱµÄÒ»¸öϰ¹ß
2 :har * p; (int *)p °ÑpÇ¿ÖÆ×ª»»ÎªintÐÍ   ......
ÕûÐͳ£Á¿¾ÍÊÇÕû³£Êý¡£Ê¹ÓõÄÕû³£ÊýÓа˽øÖÆ¡¢Ê®Áù½øÖƺÍÊ®½øÖÆÈýÖÖ¡£ Ê®½øÖÆÕû³£Êý²»ÄÜÓÐǰµ¼0£¬²»ÄÜÓзÇÊý×Ö×Ö·û¡£ °Ë½øÖÆÕû³£Êý±ØÐëÒÔ0¿ªÍ·£¬²»ÄÜÓзÇÊý×Ö×Ö·û¡£ Ê®Áù½øÖÆÕû³£Êý±ØÐëÒ»0X»ò0x¿ªÍ·£¬²»ÄÜÓзǷ¨×Öĸ£¨ ......
×î½üÔÚÍøÉϲéÁËºÃ¶à¹ØÓÚC²¥·ÅwavÕâ·½ÃæµÄ×ÊÁÏ£¬µ÷ÊÔ°ëÌìҲûÓнá¹û£¬Ëѵ½Ò»¸ö±àÒëºÃµÄEXEÎļþÄܲ¥·Å£¬Ã»ÓÐÔ´´úÂ룬·´»ã±à²»ÁË£¬ËÄÜÖ¸µãһϡ£¡£¡£¡£¡£ÒÔÏÂÁ½ÖÖ´úÂë¶Î£º
#include <stdio.h>
#include <dos.h>
/* wavÎļþ½á¹¹ */
typedef struct WaveData
{
unsigned long sample_le ......