Linux ϱàÒëhello world µÄC ÓïÑÔ³ÌÐò
±¾À´ÎÒÓõÄÊÇÕâÑùµÄ³ÌÐò
# include <iostream.h>
int main(void)
{
int i,j;
j=0;
i=j+1;
cout<<"hello world!"<<endl;
cout<<"the result is"<<i<<endl;
return 0;
}
ÀûÓÃg++ -o test test.cpp¡£µ«ÊÇÕâÑùÊÇÓдíÎóµÄ£¬ÌáʾÎÞ·¨´ò¿ªiostream.h£¬Ð޸ijÉÕâÑùµÄ³ÌÐò
# include <iostream>
using namespace std;
int main(void)
{
int i,j;
j=0;
i=j+1;
cout<<"hello world!"<<endl;
cout<<"the result is"<<i<<endl;
return 0;
}
g++ -o test test.cpp ÕâÑùÔËÐеĽá¹ûÊÇÕýÈ·µÄ¡£
<iostream>ºÍ<iostream.h>ÊDz»Ò»Ñù£¬Ç°ÕßûÓкó׺£¬Êµ¼ÊÉÏ£¬ÔÚÄãµÄ±àÒëÆ÷includeÎļþ¼ÐÀïÃæ¿ÉÒÔ¿´µ½£¬¶þÕßÊÇÁ½¸öÎļþ£¬´ò¿ªÎļþ¾Í»á·¢ÏÖ£¬ÀïÃæµÄ´úÂëÊDz»Ò»ÑùµÄ¡£
ºó׺Ϊ.hµÄÍ·Îļþc++±ê×¼ÒѾÃ÷È·Ìá³ö²»Ö§³ÖÁË£¬ÔçЩµÄʵÏÖ½«±ê×¼¿â¹¦Äܶ¨ÒåÔÚÈ«¾Ö¿Õ¼äÀÉùÃ÷ÔÚ´ø.hºó׺µÄÍ·ÎļþÀc++±ê׼ΪÁ˺ÍCÇø±ð¿ª£¬Ò²ÎªÁËÕýȷʹÓÃÃüÃû¿Õ¼ä£¬¹æ¶¨Í·Îļþ²»Ê¹Óúó׺.h¡£
Òò´Ë£¬µ±Ê¹ÓÃ<iostream.h>ʱ£¬Ï൱ÓÚÔÚcÖе÷Óÿ⺯Êý£¬Ê¹ÓõÄÊÇÈ«¾ÖÃüÃû¿Õ¼ä£¬Ò²¾ÍÊÇÔçÆÚµÄc++ʵÏÖ£»µ±Ê¹ÓÃ<iostream>µÄʱºò£¬¸ÃÍ·ÎļþûÓж¨ÒåÈ«¾ÖÃüÃû¿Õ¼ä£¬±ØÐëʹÓÃnamespace std£»ÕâÑù²ÅÄÜÕýȷʹÓÃcout¡£
Æä´ÎÔÚLinuxϱà³ÌµÄʱºò£¬C++ ÓïÑÔ³ÌÐò¿ÉÒÔ±£´æµÄ¸ñʽÊÇ.cc .C .cppÈýÕ߶¼ÊÇ¿ÉÒÔµÄ
Ïà¹ØÎĵµ£º
Author: Scurffybear Date: 2009.09.08
×î½üÔÚÕÐÐÂÈË£¬ÏÂÃæÊÇÒ»µÀCµÄÃæÊÔÌ⣬ÃæÊÔµÄÓ¡¶ÈÈËÖУ¬Ã»ÓÐÒ»¸öÈË×ö¶Ô£¬ÎÒ´Ö¿´ÁËÒ»ÏÂÌ⣬ÔÚûÓп´´ð°¸Ç°£¬ÎÒ×Ô¼ºÒ²×ö´íÁË£¬àÅ£¬Êǵģ¬Ã»É¶²»ºÃÒâ˼µÄ£¬ÎÒ¾õµÃÕâ¸öÌâÄ¿ºÜÈÝÒ×ʹÈ˲úÉúÎó½â£¬ÓÖ»òÕßÔñ£ÃÓÐÉîºñ¹¦µ×µÄÈËÄܶã¹ýÕâÒ»¸öÕÏÑÛ·¨£¿
ÒÔÏÂÊÇÌâÄ¿£¬
main()
{
char * ......
1¡¢CºÍC++¹»±¿£¬±ÆµÄ³ÌÐòÔ±×Ô¼º×öºÜ¶àÊ¡£
CÆäʵ´ó¼Ò¶¼ÖªµÀ£¬ÊÇÒ»ÃÅÖеͼ¶ÓïÑÔ£¬±£ÁôÁËÖ¸ÕëµÈ»ã±àÌØÕ÷£¬Óëϵͳµ×²ã½áºÏÃÜÇС£C++ÄØ£¬¸ü¶àµÄÏò¸öObject C£¬¼´ÃæÏò¶ÔÏóµÄC¡£µ«ÕâЩ£¬Æäʵ²¢²»Äܹ»ÈóÌÐòÔ±ÏԵúÜÅ£¡£
ÎÒ¸öÈ˵ÄÀí½â£¬Ö®ËùÒÔCºÍC++³ÌÐòÔ±ÏԵúÜÅ££¬ÆäʵÔÒòºÍ´ó¼ÒÏëÏñµÄÕýºÃÏà·´£¬²»ÊÇÒòΪCºÍC++Ì«Ç¿´ó£¬¶øÊÇÕâ ......
ת×Ô£ºhttp://blog.csdn.net/Lambol_8309/archive/2009/09/06/4524453.aspx
Ôø¾Åöµ½¹ýÈÃÄãÃԻ󲻽⡢ÀàËÆÓÚint * (* (*fp1) (int) ) [10];ÕâÑùµÄ±äÁ¿ÉùÃ÷Â𣿱¾ÎĽ«ÓÉÒ×µ½ÄÑ£¬Ò»²½Ò»²½½Ì»áÄãÈçºÎÀí½âÕâÖÖ¸´ÔÓµÄC/C++ÉùÃ÷¡£
¡¡¡¡ÎÒÃǽ«´ÓÿÌ춼ÄÜÅöµ½µÄ½Ï¼òµ¥µÄÉùÃ÷ÈëÊÖ£¬È»ºóÖð²½¼ÓÈëconstÐÞÊηûºÍtypedef£¬»¹Óк¯ÊýÖ¸Õ ......
static char *file2memory(FILE *file, long *size)
{
char buffer[1024];
char *string=NULL;
char *newstring=NULL;
long len=0;
long stringlen=0;
if(file) {
while((len = fread(buffer, 1, sizeof(buffer), f ......
£¨Ò»£©
¶ÔÎļþ²Ù×÷ʱÓÐʱ»ñµÃÎļþµÄ´óСʱ±ØÒªµÄ.ÏÂÃæÊÇ»ñµÃÆä´óССµÄ½Ï¼òµ¥·½·¨.
#include<io.h> //CÓïÑÔÍ·Îļþ
#include<iostream> //for system();
using namespace std;
int main()
{
int handle;
handle = open("test.txt", 0x0100); //open file for rea ......