ÓÖÊÇ3Ö»C¡£¡£¡£= =
1.д³öÁ½¸öº¯Êý£¬·Ö±ðÇóÁ½¸öÕûÊýµÄ×î´ó¹«Ô¼ÊýºÍ×îС¹«±¶Êý£¬ÓÃÖ÷º¯Êýµ÷ÓÃÕâÁ½¸öº¯Êý£¬²¢Êä³ö½á¹û¡£Á½¸öÕûÊýÓɼüÅÌÊäÈë¡£
#include<stdio.h>
int gcd(int,int);
int lcm(int,int);
int gcd(int m,int n)
{
if(m%n==0)
return n;
else
return gcd(n,m%n);
}
int lcm(int m,int n)
{
return m*n/(gcd(m,n));
}
int main()
{
int a,b,t;
printf("ÊäÈëÁ½¸öÕûÊý\n");
scanf("%d %d",&a,&b);
if(a-b<0)
{
t=a;
a=b;
b=t;
}
printf("×î´ó¹«Ô¼ÊýΪ%d\n",gcd(a,b));
printf("×îС¹«±¶ÊýΪ%d\n",lcm(a,b));
return 0;
}
2.Çó·½³Ìax2
+bx+c=0µÄ¸ù£¬ÓÃ3¸öº¯Êý·Ö±ðÇóµ±b2
-4ac´óÓÚ0£¬µÈÓÚ0ºÍСÓÚ0ʱµÄ¸ù²¢Êä³ö½á¹û¡£´ÓÖ÷º¯ÊýÊäÈëa£¬b£¬cµÄÖµ¡£
#include<stdio.h>
#include<math.h>
int f1(float,float,float);
int f2(float,float);
int f3(float,float,float);
int f1(float a,float b,float c)
{
float t,x1,x2;
t=sqrt(b*b-4*a*c);
x1=((0-b)+t)/2/a;
x2=((0-b)-t)/2/a;
printf("·½³ÌÓÐÁ½¸öʵ¸ù\nx1=%f\nx2=%f\n",x1,x2);
return 0;
}
int f2(float a,float b)
{
float x;
x=(0-b)/2/a;
printf("·½³ÌÓÐÒ»¸öʵ¸ù\nx=%f\n",x);
return 0;
}
int f3(float a,float b,float c)
{
float t,p,q;
t=sqrt(4*a*c-b*b);
p=(0-b)/2/a;
q=t/2/a;
printf("·½³ÌÓÐÁ½¸öÐé¸ù\nx1=%f+%fi\nx2=%f-%fi\n",p,q,p,q);
return 0;
}
int main()
{
float a,b,c;
printf("ÊäÈëa b c\n");
scanf("%f %f %f",&a,&b,&c);
if(b*b-4*a*c>0)
f1(a,b,c);
else
{
if(b*b-4*a*c<0)
f3(a,b,c);
else
f2(a,b);
}
return 0;
}
3.дһ¸öÅÐËØÊýµÄº¯Êý£¬ÔÚÖ÷º¯ÊýÊäÈëÒ»¸öÕûÊý£¬Êä³öÊÇ·ñËØÊýµÄÐÅÏ¢¡£
#include<stdio.h>
#include<math.h>
int judge(int);
int judge(int x)
{
int i;
for(i=2;i<=sqrt(x)+1;i++)
{
if(x%i==0)
return 0;
else
continue;
}
return 1;
}
int main()
{
int t,n;
printf("ÊäÈëÒ»¸öÕûÊý\n");
scanf("%d",&n);
t=judge(n);
if(t==1)
printf("ÊÇËØÊý\n");
else
printf("²»Ê
Ïà¹ØÎĵµ£º
±àÕß°´
:·Ç³£»ù±¾¹ØÓÚCÓïÑÔµÄÎÊÌâ,Ò»¸öÐÅÏ¢Àà(¼ÆËã»ú,×ÊѶ¹¤³Ì,µç×Ó¹¤³Ì, ͨÐŹ¤³Ì)רҵµÄ±¾¿Æ±ÏÒµÉúÓ¦¸Ã´ïµ½µÄˮƽ¡£ÌâÄ¿²»ÄÑ,È«²¿¶¼ÄÜ¿ìËٵشðÍ꣬µ±È»Ò²ÐèÒªÒ»¶¨µÄ֪ʶ´¢±¸¡£
¶ÔÓÚ´ó¶àÊýÈË£¬ÎÒÃÇÔ¤ÆÚÄã¿ÉÄÜ´ð´í 3) 4) 15)Ì⣬ËùÒÔ´ð´í3µÀÒÔÄڵģ¬ÎÒÃÇÈÏΪÄãºÜ°ô
´ð´í5µÀÌâÒÔÄÚ£¬ÎÒÃÇÈÏΪÄ㻹²»´í(Ä ......
×òÌìÍíÉÏÔÚ¿´C/C++¶ÔÊý¾Ý¿âµÄ²Ù×÷,ÃÍÈ»¼ä¾õµÃÊ®·ÖÇ×ÇУ¬ÒòΪÆäÖкܶຯÊý¶¼ºÍPHPÖжÔMySQL²Ù×÷Ïàͬ£¬ÕâÊDzÅÏëÆðPHPÊÇCÑÝ»¯¶øÀ´µÄ¡£¾¹ýÒ»·¬µ·ÌÚ£¬ÖÕÓÚÍê³ÉÁËÒ»¸ö¼òµ¥µÄ³ÌÐò£¬µ«ÊÇÈÔÈ»´æÔÚ×ÅÒ»¸öÑÏÖصÄÎÊÌ⣬¾ÍÊÇ´ÓÊý¾Ý¿âÖеõ½µÄ½á¹ûÔÚÆÁÄ»ÉÏÏÔʾµÄÊÇÂÒÂ룬ºÜÈÃÈË·³¡£»¹Íû¸ßÊÖÃǴͽ̣¡
1.ÔÚ»úÆ÷ÉÏ×°ÉÏMySQL £¬¼ÙÉè°²×°ÔÚ C ......
±àÒë³ÌÐò£¬ÌáʾCÅ̿ռ䲻×㣬ÎÒÇåÀícÅ̺ó£¬É¾³ýûÓõÄÈí¼þºó£¬·¢Ïֿռ仹ÊǺÜÉÙ£¬½ö½öÌáÉý200M×óÓÒ£¬ºÜÊÇÆæ¹Ö£¬Îҵÿռ䶼±»Ê²Ã´Õ¼È¥ÁËÄØ£¿
¾¹ý²é¿´£¬·¢ÏÖC:\Documents and Settings\tangh\Application Data\VisualAssistĿ¼¾¹È»ÓÐ5G¶à£¬ÎÒµÄÂèѽ£¬ÉÏÍøÒ»²é£¬ÍøÉÏ˵Ëû˵CÅÌɱÊÖ£¬¸É´àÕ¤ÁË£¬Ã»ÓÐʲôӰÏ죡
......
1.
printf("%.9lf\n",sum);
//Êä³öСÊýµãºó9λ²»Ê¡È¥Ä©Î²¶àÓàµÄ0
2.
printf("%.10g\n",sum);
//Êä³öСÊýµãºó9λ²»Ê¡È¥Ä©Î²¶àÓàµÄ0
3.
#include<iomanip>
cout<<setprecision(10)<<sum<<endl;
//Êä³öСÊýµãºó9λʡȥĩβ¶àÓàµÄ0
4.
#include<iomanip>
cout.pre ......
#include<reg52.h>
#define uchar unsigned char
#define uint unsigned int
uchar num;
void main()
{
TMOD=0x01;
TH0=(65536-45872)/256;
TL0=(65536-45872)%256;
EA=1;
ET0=1;
TR0=1;
P1=0xFF;
while(1);
}
void T0_time() interrupt 1
{
  ......