c primer plus Ò»µÀÁ·Ï°Ì⣬ÇóÖú - C/C++ / CÓïÑÔ
ÌâÄ¿ÊÇ£º±àдһ¶Î³ÌÐò£¬ÒÀ´ÎÔÚÆÁÄ»ÉÏÏÔʾÃüÁîÐÐÖÐÁгöµÄËùÓÐÎļþ¡£Ê¹ÓÃargc¿ØÖÆÑ»·
£¨Write a program that sequentially displays onscreen all the files listed in the command line. Use argc to control a loop.£©
¼¸ºõÊÇÕÕ³ÍøÉϵÄÁ·Ï°Ô´´úÂ룬µ«½á¹ûÊÇ´íµÄ
C/C++ code:
1 #include <stdio.h>
2 #include <stdlib.h>
3
4
5 int main(int argc,char *argv[])
6 {
7 int byte;
8 FILE *source;
9 int filect;
10
11 if(argc==1)
12 {
13 printf("Usage: %s filename[s]\n",argv[0]);
14 exit(EXIT_FAILURE);
15 }
16
17 for(filect=1;filect<argv;filect++)
18 {
19 if((source=fopen(argv[filect],"r"))==NULL)
20 {
21 printf("Counld not open file %s for input\n",argv[filect]);
22 continue;
23 }
24
25 while((byte==getc(source))!=EOF)
26 {
27 putchar(byte);
28 // putc(byte,stdout);
29 }
30
31 if(fclose(source)!=0)
32 {
33 printf("Counld not close file %s\n",argv[1]);
34 }
35 }
36 return 0;
ubuntuÏÂÔËÐнá¹ûΪ
C/C++ code
��������������ʏ
Ïà¹ØÎÊ´ð£º
дÁ˸ö²âÊÔ³ÌÐòÈçÏÂ
struct hostent *hp;
char AlarmDevIP[20];
int x2;
hp = gethostbyname("www.google.com");
if (hp)
{
......
±¾ÈËÕýÔÚÓÃJava×öÒ»¸öC/S¼Ü¹¹µÄÏîÄ¿£¬
¿ÉÊÇÓÉÓÚÏîÄ¿±È½Ï´ó£¬Ç°ÆÚ¶Ô¼Ü¹¹µÄÉè¼ÆÓÈÆäÖØÒª£¬ÒòΪºóÆÚ¿ÉÄÜËæÊ±»á¼Ó¸ö¹¦ÄÜ»òÕßÈ¥µôijЩ¹¦ÄÜ¡£
ËùÒÔÌØµØÑ°ÇóÈçºÎÉè¼ÆC/SµÄ¼Ü¹¹Ê¹³ÌÐò¸ü¼ÓÃæÏò¶ÔÏó¸ü¼ÓÒ×ÓÚά ......
´ó¼ÒºÃ£º
ÎÒÏëʵÏÖ¼ì²âµ½²åÈëSD¿¨ºó×Ô¶¯½«SD¿¨¸ñʽ»¯µÄ¹¦ÄÜ£¬²»ÖªC/C++ÖÐÓÐûÓиñʽ»¯UÅ̵ĺ¯Êý£¿
ÁíÍ⣬ÎÒ²»ÏëʹÓÃSHFormatDrive£¬ÒòΪÕâ¸öº¯Êý»áµ¯³öÊÇ·ñÒª¸ñʽ»¯µÄÌáʾ¿ò£¬ÎÒÐèÒªµÄÊÇϵͳ×Ô¶¯¸ñʽ»¯£¬¶ø²Ù×÷Õß² ......
ΪʲôÎҵijÌÐòµ÷ÓÃXMLÅäÖÃÎļþÖеİ¢À²®ÎÄÏÔʾ²»³öÀ´£¿ÆäËûµÄÓïÖÖ¶¼¿ÉÒÔ£¬ÈçÖÐÎÄ£¬Ó¢ÎÄ£¬µÂÎͼ¿É¡£
ÎÒ½«XMLµÄ±àÂë¸ÄΪutf-8ºÍunicodeµÄµ½µÃ½á¹û¶¼Ò»Ñù.
°¢À²®ÎĵÄ×Ö¿âÄãÓÐô£¿
ÓÐ,ÎÒµÄEXEÊÇ·ÅÔÚpc»úÉÏÖ´Ðе ......
ËÄܰïÎÒ°ÑÏÂÃæÕâЩ´úÂë¸Ä³ÉVBÐÎʽµÄ£¬¶àлÁË£¬¼±ÓÃ~~
#include "stdlib.h"
#include "math.h"
#include "stdio.h"
float objfx(float x[]);
void constraint(float x[],float g ......