cµÄ×Ö·û´®ÎÊÌâ
fastshow()
{
FILE *fp;
char name[10];
char ch[512];
printf("ÇëÊäÈë´ýÏÔʾµÄÎļþÃû\n");
scanf("%s",name);
if((fp=fopen(name,"r"))==NULL)
{
printf("²»ÄÜ´ò¿ªÎļþ!\n");
exit(0);}
fgets(ch,10000,fp);
printf("%s",ch);
}
Õâ¸öº¯ÊýÖÐch[512]ÊDz»ÊǺÜÀ˷ѿռ䣬Èç¹ûÎļþÀïÃæÖ»ÓÐÒ»¸ö×Ö·ûÄÇ511×Ö½Ú²»¾ÍÀË·ÑÁËÂð£¿
»¹ÓУ¬¼ÈÈ»ÊÇ512×Ö½ÚΪʲôfgetsº¯ÊýµÄµÚ¶þ¸ö²ÎÊý¿ÉÒÔд³É10000£¿
Äܲ»ÄÜÏñvbÒ»Ñù£¬ÉùÃ÷Ò»¸östringÔÙ¸³Öµ
±ÈÈ磺string a£»fgets(ch,10000,fp)£»£¿
µÚÒ»¸öÎÊÌâ ЧÂʱȿռä¸üÖØÒª£¬ÖÁÉÙ511²»ËãÀË·Ñ
µÚ¶þ¸öÎÊÌâ°³Ò²²»ÖªµÀÄñ ûÕâôÓùý
fgets()µÄµÚ¶þ¸ö²ÎÊý˵Ã÷×î´ó¶ÁÈëµÄ×Ö·ûÊý¡£Èç¹ûÕâ¸ö²ÎÊýֵΪn£¬ÄÇôfgets()¾Í»á¶ÁÈ¡×î¶àn-1¸ö×Ö·û»ò¶ÁÍêÒ»¸ö»»ÐзûΪֹ¡£
µÚ¶þ¸öÎÊÌâ°³Ò²²»ÖªµÀ
ÎÒµÄÒâ˼ÊÇ ÍòÒ»ÎļþºÜ´ó ±ÈÈçÍøÒ³µÄÔ´ÎļþÓÐÉÏÍòµÄ×Ö·ûÎÒµÄ×Ö·ûÊý×éÊDz»ÊÇ»¹Ó¦¸ÃÓÃch[10000]?
ÓÐûÓкõķ½·¨£¬ÈÃ×Ö·ûÊý×éËæ´ý¿½±´µÄÎļþ´óС¶ø¶¨£¿
fgets(ch,10000,fp);ÓзçÏÕ¡¡
ÁíÍâ1gÄÚ´æÒ²¾Í100¿éÉÏÏ°ɣ¿511×Ö½ÚÄÚ´æÖµ²»Á˼¸¸öÇ®¡¡
ÔÚδ»ñµÃÊäÈëÇ°£¬Ôõô¿ÉÄÜÈ·¶¨×¼È·µÄ¿Õ¼ä´óС£¿
¾ÍËãÊÇstring£¬²»¹ýÊÇϵͳ×Ô¼ºÉêÇëÁÙʱ¿Õ¼ä°ïÄã¹ý¶Éһ϶øÒÑ
Èç¹ûÊǸö¾Ö²¿±äÁ¿£¬ÀË·ÑһʱҲÊÇ¿ÉÒÔ½ÓÊܵģ¬³öÁË×÷ÓÃÓò²»¾Ã»ØÊÕÁËĪ£¿
ÖÁÓÚfgets£¬ÐèÒªµÄ½öÊǸöÖ¸Õ룬ÒòΪ¿¼Âǵ½Áé»îÐÔ£¨ÎҲµģ¬Ò²ÐíÊÇд±ê×¼¿âµÄ´òî§Ë¯£©£¬Ëü²»¹ØÐÄÄã¿ÉÓÿռä´óС£¬Ö»ÖªµÀ½«fpÖеÄÄÚÈÝ°áÔËÄã¸æËßËüµÄÄÇÃ
Ïà¹ØÎÊ´ð£º
ËÄÜ°ïÎÒ°ÑÏÂÃæÕâЩ´úÂë¸Ä³ÉVBÐÎʽµÄ£¬¶àлÁË£¬¼±ÓÃ~~
#include "stdlib.h"
#include "math.h"
#include "stdio.h"
float objfx(float x[]);
void constraint(float x[],float g ......
¹«Ë¾¿ª·¢Ò»¸ö´¥ÃþÆÁ³ÌÐò£¬ÎÒ¸ºÔðµÄÒ»¿é£¬ÊµÏÖÕâÑùÒ»¸ö¹¦ÄÜ£¬µ±Êó±êµã»÷´°¿ÚÖÐͼƬ£¨Ò»ÕÅͼ·Ö³É¼¸²¿·Ö£©µÄÆäÖÐÒ»²¿·Öʱ£¬½«Õⲿ·ÖͼƬ½ØÈ¡³öÀ´£¬µ¯³öеĴ°¿Ú£¬½«½ØÈ¡³öµÄͼƬÏÔʾ³öÀ´¡£ÎÒʹÓÃRectangeÀà¿ØÖÆÁË·µ»Ø£¬ ......
СµÜ×î½üÔÚÁ˽â¹ØÓÚtiny c µÄÎÊÌâ¡£ÔÚlinuxÏÂ×¼±¸°²×°¡£µ«°²×°Íê³ÉºóÅöµ½ÁËһЩÎÊÌ⡣ϣÍû´ó¼ÒÄܹ»°ïæ½â¾ö¡£ÒÔÏÂÊÇ°²×°Íê³ÉºóµÄÖ´Ðв½Öè¡£
[student@localhost ~]$ tcc -v
tcc version 0.9.25
[student@localhos ......