±à³ÌÇóÒ»Ôª¶þ´Î·½³Ìax2+bx+c=0µÄ¸ù
ͻȻ·¢ÏÖ×Ô¼ºÁ¬Ò»Ôª¶þ´Î·½³ÌÔõôËãµÄ¶¼²»ÖªµÀÁË¡£ÏëÁË°ëÌ죬ÄÃÆð±ÊÀ´²Å˳ÊÖЩÁ˸øx2+2x+1=0.»ÚºÞ°¡¡£
#include "iostream"
#include "cmath"
using namespace std;
int main(){
double a,b,c;
double delta,x1,x2;
int sign,stop;
cout<<"ÊäÈë3¸öϵÊýa(a!=0),b,c"<<endl;
cin>>a>>b>>c;
if(a==0){
cout<<"a²»ÄܵÈÓÚ0!!!!²»È»Õâ¾Í²»ÊÇÒ»Ôª¶þ´Î·½³ÌʽÁË"<<endl;
exit(0);
}
delta=b*b-4*a*c;
if(delta==0){
cout<<"·½³ÌÓÐÁ½¸öʵ¸ù£ºx1=x2="<<-b/(2*a)<<endl;
}
else{
if(delta>0) sign=1;
else sign=0;
delta=sqrt(fabs(delta));
x1=-b/(2*a);
x2=delta/(2*a);
if(sign){
cout<<"·½³ÌÓÐÁ½¸ö²»Í¬µÄʵ¸ù£ºx1="<<x1+x2<<" x2="<<x1-x2<<endl;
}
else{
cout<<"·½³ÌÎÞʵ¸ù£¬ÓÐÁ½¸ö²»Í¬µÄ¸´Êý¸ù£ºx1="<<x1<<"+i"<<x2<<" x2="<<x1<<"-i"<<x2<<endl;
}
}
}
Ïà¹ØÎĵµ£º
ÔÚCÓïÑÔÖУ¬staticµÄ×ÖÃæÒâ˼ºÜÈÝÒ×°ÑÎÒÃǵ¼ÈëÆç;£¬ÆäʵËüµÄ×÷ÓÃÓÐÈýÌõ¡£
£¨1£©ÏÈÀ´½éÉÜËüµÄµÚÒ»ÌõÒ²ÊÇ×îÖØÒªµÄÒ»Ìõ£ºÒþ²Ø¡£
µ±ÎÒÃÇͬʱ±àÒë¶à¸öÎļþʱ£¬ËùÓÐδ¼Óstaticǰ׺µÄÈ«¾Ö±äÁ¿ºÍº¯Êý¶¼¾ßÓÐÈ«¾Ö¿É¼ûÐÔ¡£ÎªÀí½âÕâ¾ä»°£¬ÎÒ¾ÙÀýÀ´ËµÃ÷¡£ÎÒÃÇҪͬʱ±àÒëÁ½¸öÔ´Îļþ£¬Ò»¸öÊÇa.c£¬ÁíÒ»¸öÊÇmain.c¡£
ÏÂÃæÊÇa.cµÄÄÚÈÝ
ch ......
ÍøÂí¼ÓÃÜÖУ¬Ä¿Ç°Óиöfunction(p,a,c,k,e,d)µÄ£¬·Ç³£ÌÖÑᣬÎÒÒ²ÊÇÉî¶ñÍ´¾ø£¬¼ÇµÃÎÒ¸Õ¿ªÊ¼Åöµ½ËüµÄʱºò£¬Æ´ÃüµØ¶Áº¯Êý£¬ÄǸö½ÐÍ´¿à°¡£¬¿Ä¿Ä°í°íµØÃãÇ¿¸ãÁ˳öÀ´¡£½ñÌ죬ͻȻ¿´¼ûÁËfunction(p,a,c,k,e,d)µÄ½âÃÜ´úÂ룬¸ßÐ˶¼À´²»¼°
<script>
a=62;
function encode() {
var code = document.getElementById('code' ......
c±ä³ÉµÄ¶ÔÏó´ó¶àÊǹ²ÏíÄÚ´æÖÐÉêÇ룬±È½ÏÉÙÓÃmallocÖ±½ÓÀ´ÉêÇ룬ËùÒÔÁ´±íÉè¼ÆÒ»°ãÊÇÏÂÃæ2Öнṹ£º
¶ÔÏó --> ¶ÔÏó --> ¶ÔÏó
¶ÔÏó -->Á´±í¶ÔÏó-->¶ÔÏó -->Á´±í¶ÔÏó
£¨1£©¶ÔÓÚµÚÒ»ÖÖ£¬Á´±íÖ±½Ó¹ØÁªµ½¶ÔÏó±¾Éí£¬ËùÒÔÈç¹ûÒ»¸ö¶ÔÏóÔÚÏûÍöʱ£¬Ã»Óм°Ê±ÇåÀíµôÁ´±í¹Øϵ£¬Ôò»áµ¼ÖÂÁ´±íµôÁ´¡£
£¨2£©Á´±í¶ÔÏó±¾ÉíÊÇÒ» ......
ΪʲôÐèҪʹÓÃextern "C"ÄØ£¿C++Ö®¸¸ÔÚÉè¼ÆC++֮ʱ£¬¿¼Âǵ½µ±Ê±ÒѾ´æÔÚÁË´óÁ¿µÄC´úÂ룬ΪÁËÖ§³ÖÔÀ´µÄC´úÂëºÍÒѾдºÃC¿â£¬ÐèÒªÔÚC++Öо¡¿ÉÄܵÄÖ§³ÖC£¬¶øextern "C"¾ÍÊÇÆäÖеÄÒ»¸ö²ßÂÔ¡£
¡¡¡¡ÊÔÏëÕâÑùµÄÇé¿ö:Ò»¸ö¿âÎļþÒѾÓÃCдºÃÁ˶øÇÒÔËÐеúÜÁ¼ºÃ£¬Õâ¸öʱºòÎÒÃÇÐèҪʹÓÃÕâ¸ö¿âÎļþ£ ......
ÎÒÃǶ¼ÖªµÀgccµÄ-S¿ª¹Ø¿ÉÒÔÓÃÀ´Éú³É»ã±à´úÂ룬
µ«ÓÐʱºò£¬µ¥Óлã±àÎļþÊDz»¹»µÄ£¬ÎÒÃÇÏ£ÍûµÄÊǽ«CÓïÑÔ³ÌÐòµÄÔ´´úÂëºÍ»ã±àÓïÑÔÎı¾½»´íÔÚÒ»Æð²é¿´£¬
ÕâÊÇLISTING¹¦ÄÜ£¬ÔÚgccÖв¢Ã»ÓÐרÃŵÄFAQ˵Ã÷£¬
ÇøÇøÔÚÍøÉϲéÁ˺ܶà×ÊÁϲÅÖªµÀÔõôʵÏÖ£¬ËùÒÔÌش˼ÇÏ¡£
gcc -c -g -Wa,-adlhn ee.c > ee.anno.s
ÓÉ´ËÉú³ÉµÄe ......