Т¸ÐѧԺ-ÎïµçѧԺʵÑéÖÐÐÄ
t=str[i]; str[i]=str[i+1]; str[i+1]=t; } }
¡¾Àý3¡¿ÓÃÅ£¶Ùµü´ú·¨Çó¸ù¡£·½³ÌΪax3+bx2+cx+d=0£¬ÏµÊýa¡¢b¡¢c¡¢dÓÉÖ÷º¯ÊýÊäÈë¡£ÇóxÔÚ1¸½½üµÄÒ»¸öʵ¸ù¡£Çó³ö¸ùºó£¬ÓÉÖ÷º¯ÊýÊä³ö¡£ Ô´³ÌÐòÈçÏ£º /*Å£¶Ùµü´ú·¨½â·½³Ì*/ #include ¡°math.h¡± float solut(a,b,c,d) float a,b,c,d; {
float x=1,x0,f,f1; do { x0=x;
f=((a*x0+b)*x0+c)*x0+d; f1=(3*a*x0+2*b)*x0+c; x=x0-f/f1;
}while(fabs(x-x0)>=1e-5); return(x); } main() {
float a,b,c,d;
printf(¡°\\nÊäÈë·½³ÌµÄϵÊýa,b,c,d\\n¡±); scanf(¡°%f,%f,%f,%f¡±,&a,&b,&c,&d);
printf(¡°\\n·½³ÌÊÇ£º%5.2fx^3+%5.2fx^2+%5.2fx+%5.2f=0¡±,a,b,c,d);
printf(¡°\\nX=.7f\\n¡±,solut(a,b,c,d));}
ÔÚ´ËÌâÄ¿ÖУ¬·½³ÌµÄϵÊýÊÇδ֪µÄ£¬ÕâÊÇÓëÒÔÇ°ÎÒÃÇÓÃÅ£¶Ùµü´ú·¨µÄʱºò²»Í¬µÄµØ·½¡£µ«ÔÀí¡¢Ëã·¨ÊÇÏàͬµÄ£¬ÕâÀïÎÒÃÇÓú¯ÊýÀ´Ç󷽳̵ĸù¡£Ò²¾ÍÊÇ°ÑÅ£¶Ùµü´ú·¨Óú¯ÊýµÄÐÎʽ±íÏÖ³öÀ´¡£ ¡¾×÷Òµ¡¿
1£® ÉÏ»úµ÷ÊÔÏÂÃæµÄ³ÌÐò£¬¼Ç¼ϵͳ¸ø³öµÄ³ö´íÐÅÏ¢£¬²¢Ö¸³ö³ö´íÔÒò¡£
main() { int x,y;
printf(\int sum(a,b); { int a,b; return(a+b); } }
2£®¶¨ÒåÒ»¸öº¯Êý£¬¹¦ÄÜÊǼÆËãn¸öѧÉúµÄ³É¼¨ÖУ¬¸ßÓÚƽ¾ù³É¼¨µÄÈËÊý£¬²¢×÷Ϊº¯ÊýÖµ¡£ÓÃÖ÷º¯ÊýÀ´µ÷ÓÃËü£¬Í³¼Æ50¸öѧÉú³É¼¨ÖУ¬¸ßÓÚƽ¾ù³É¼¨µÄÓжàÉÙÈË£¿
3£®±àдһ¸ö¶Ôn¸öÊý¾Ý´Ó´óµ½Ð¡µÄÅÅÐòCº¯Êý£¬ÔÙ±àдһ¸ö¼ÆËã×îºóµÃ·ÖµÄCº¯Êý£¬¼ÆËã·½
26
Ö½ÉϵÃÀ´ÖÕ¾õdz£¬¾øÖª´ËÊÂÒª¹ªÐÐ
Т¸ÐѧԺ-ÎïµçѧԺʵÑéÖÐÐÄ
·¨ÊÇ£ºÈ¥³ýÒ»¸ö×î¸ß·Ö£¬È¥³ýÒ»¸ö×îµÍ·Ö£¬ÆäÓàµÄƽ¾ù·ÖΪ²ÎÈüÑ¡ÊÖµÄ×îºóµÃ·Ö¡£²¢ÔÚÖ÷º¯ÊýÖе÷ÓÃËüÃǶÔÓÐn¸öÆÀίÆÀ·Ö£¬m¸öÑ¡ÊÖ²ÎÈüµÄ×îºóµÃ·Ö£¬´Ó´óµ½Ð¡ÅÅÐòÊä³ö¡£ 4£®±àдһ¸ö¼ÆËãn!µÄº¯Êý£¬ÓÃÖ÷º¯Êýµ÷ÓÃËü£¬Ê¹Ö®Êä³ö7½×Ñî»ÔÈý½ÇÐΣº
1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 1 5 10 10 5 1 1 6 15 20 15 6 1 1 7 21 35 35 21 7 1
Ñî»ÔÈý½ÇÐÎÊǶþÏîÕ¹¿ªÊ½(a+b)nµÄϵÊý£¬¹²ÓÐn+1Ïn=0£¬1£¬¡¡£Ñî»ÔÈý½ÇÐÎÔÚÊýѧÉϾßÓÐÖØÒªµÄÒâÒ壬ÔÚ¸ßÖн׶ÎÒÑѧ¹ý£¬ÏµÊýÊÇ°´ÕÕ¹«Ê½£ºam= £¬ÆäÖÐamÊÇÕ¹¿ªÊ½ÖеĵÚmÏîϵÊý¡£
5£®±àдһ¸ö³ÌÐò£¬°üÀ¨Ö÷º¯ÊýºÍÈçÏÂ×Óº¯Êý¡£ (1) ÊäÈë10¸öÎÞÐòµÄÕûÊý£» (2) ÓÃÆðÅÝ·½·¨´Ó´óµ½Ð¡ÅÅÐò£»
(3) ÒªÇóÊäÈëÒ»¸öÕûÊý£¬ÓÃÕÛ°ë²éÕÒ·¨ÕÒ³ö¸ÃÊý£¬Èô´æÔÚ£¬ÔÚÖ÷º¯ÊýÖÐÊä³öÆäËù´¦µÄλÖ㬷ñ
Ôò£¬²åÈëÊʵ±Î»Öá£
·ÖÎö£ºinputº¯ÊýÍê³É10¸öÕûÊýµÄ¼Èë¡£sortº¯ÊýÍê³ÉÆðÅÝ·¨ÅÅÐò£¬searchº¯ÊýÍê³ÉÊäÈëÊý
µÄ²éÕÒ¡£
27
Ö½ÉϵÃÀ´ÖÕ¾õdz£¬¾øÖª´ËÊÂÒª¹ªÐÐ
Т¸ÐѧԺ-ÎïµçѧԺʵÑéÖÐÐÄ
ʵÑé¾Å ÎÄ ¼þ
¡¾Ä¿µÄÓëÒªÇó¡¿
1£®ÕÆÎÕÎļþºÍÎļþÖ¸ÕëµÄ¸ÅÄîÒÔ¼°ÎļþµÄ¶¨Òå·½·¨¡£ 2£®Á˽âÎļþ´ò¿ªºÍ¹Ø±ÕµÄ¸ÅÄîºÍ·½·¨¡£ 3£®ÕÆÎÕÓйØÎļþµÄº¯Êý¡£ ¡¾ÉÏ»úÄÚÈÝ¡¿
¡¾Àý1¡¿¶Ôdata.datÎļþдÈë100Ìõ¼Ç¼¡£
#include
FILE *fp; int i; float x;
fp=fopen(\for(i=1;i<=100;i++) {
scanf(\fprintf(fp,\}
fclose(fp);}
¡¾Àý2¡¿ÉèÓÐÒ»Îļþcj.dat´æ·ÅÁË50¸öÈ˵ijɼ¨£¨Ó¢Óï¡¢¼ÆËã»ú¡¢Êýѧ£©£¬´æ·Å¸ñʽΪ£ºÃ¿ÈËÒ»
ÐУ¬³É¼¨¼äÓɶººÅ·Ö¸ô¡£¼ÆËãÈýÃÅ¿Îƽ¾ù³É¼¨£¬Í³¼Æ¸öÈËƽ¾ù³É¼¨´óÓÚ»òµÈÓÚ90·ÖµÄѧÉúÈËÊý¡£ #include
int num;
float x , y , z , s1 , s2 , s3 ; fp=fopen (\{
fscanf (fp,\s1=s1+x; s2=s2+y; s3=s3+z;
if((x+y+z)/3>=90) num=num+1; }
printf(\·ÖÊý¸ßÓÚ90µÄÈËÊýΪ£º%.2d\fclose(fp);}
¡¾Àý3¡¿Í³¼ÆÉÏÌâcj.datÎļþÖÐÿ¸öѧÉúµÄ×ܳɼ¨£¬²¢½«ÔÓÐÊý¾ÝºÍ¼ÆËã³öµÄ×Ü·ÖÊý´æ·ÅÔÚ´ÅÅÌ
Îļþ¡°stud¡±ÖС£ #include \main()
28
Ö½ÉϵÃÀ´ÖÕ¾õdz£¬¾øÖª´ËÊÂÒª¹ªÐÐ
Т¸ÐѧԺ-ÎïµçѧԺʵÑéÖÐÐÄ
{ FILE *fp1,*fp2;
float x,y,z;
fp1=fopen(\fp2=fopen(\while(!feof(fp1)) {
fscanf (fp1,\printf(\fprintf(fp2,\}
fclose(fp1); fclose(fp2); } ¡¾×÷Òµ¡¿
1. ÓÐ 5¸öѧÉú£¬Ã¿¸öѧÉúÓÐ3Ãſεijɼ¨£¬´Ó¼üÅÌÊäÈëÒÔÉÏÊý¾Ý£¨°üÀ¨Ñ§ÉúºÅ£¬ÐÕÃû£¬ÈýÃÅ¿Î
³É¼¨£©£¬¼ÆËã³öƽ¾ù³É¼¨£¬½«ÔÓÐÊý¾ÝºÍ¼ÆËã³öµÄƽ¾ù·ÖÊý´æ·ÅÔÚ´ÅÅÌÎļþ¡°stud¡±ÖС£ 2. ½«ÉÏÌâ¡°stud¡±ÎļþÖеÄѧÉúÊý¾Ý£¬°´Æ½¾ù·Ö½øÐÐÅÅÐò´¦Àí£¬½«ÒÑÅÅÐòµÄѧÉúÊý¾Ý´æÈëÒ»¸öÐÂ
Îļþ¡°stu_sort¡±ÖС£
29
Ö½ÉϵÃÀ´ÖÕ¾õdz£¬¾øÖª´ËÊÂÒª¹ªÐÐ