ÇÁ·Î±×·¡¹Ö

 3204, 11/161 ȸ¿ø°¡ÀÔ  ·Î±×ÀΠ 
   ddrsinger
   C¾ð¾î·Î§ ´ÙÇ×½ÄÀÔ´Ï´Ù. ÀßÇϽôºР¼Ò½ºÇؼ®Á»;;;

http://www.hackerschool.org/HS_Boards/zboard.php?desc=desc&no=1649 [º¹»ç]


ÈÄ..±º´ë ´Ù³à¿Í¼­ C¾ð¾î ´Ù½Ã ÇÏ·Á´Ï±î º¹ÀâÇØÁö³»¿ä;;;Áö±Ý 2Çгâ ÀçÇÐÁßÀδë

Àú ½î½º..ÀÏ´Ü ±æ¾îÁö´Ï Çؼ®ÇϱⰡ Èûµë;;;À߾ƽôºРÇؼ®Á» ÇØÁÖ¼¼¿ä..Àú°ÉÀÌÇØ

ÇØ¾ß -,*,/<<¼¼°¡Áö ÀÛ¼ºÇÒ¼ö°¡;¤Ð¤Ð
#include <stdio.h>
#define MAX(a,b) ((a>b)?a:b)
#define MAX_DEGREE 50

typedef struct{
int degree;
float coef[MAX_DEGREE];
} polynomial;

polynomial addPoly(polynomial A, polynomial B)
{
polynomial C;
int A_index=0, B_index=0,C_index=0;
int A_degree=A.degree, B_degree=B.degree;
C.degree=MAX(A.degree, B.degree);

while(A_index<=A.degree && B_index<=B.degree) {
  if(A_degree > B.degree) {
   C.coef[C_index++] = A.coef[A_index++];
   A_degree--;
  }
  else if(A_degree == B_degree) {
   C.coef[C_index++]=A.coef[A_index++]+B.coef[B_index++];
   A_degree--;
   B_degree--;
  }
  else{
   C.coef[C_index++] = B.coef[B_index++];
   B_degree--;
  }
}
return C;
}


void printPoly(polynomial P)
{
int i, degree;
degree=P.degree;

for(i=0; i<=P.degree; i++)
  printf("%3.0fx^%d", P.coef[i], degree--);
printf("\n");
}


void main()
{
polynomial A={3, {4,3,5,0}};
polynomial B={4, {3,1,0,2,1}};

polynomial C;
C= addPoly(A,B);

printf("\n A(x)="); printPoly(A);
printf("\n B(x)="); printPoly(B);
printf("\n C(x)="); printPoly(C);
  

getchar();
}


  Hit : 5258     Date : 2008/04/07 01:46



    
3004   ¿Â¶óÀÎ °ÔÀÓ ÇÁ¸®¼­¹öÀÇ ¿ø¸®´Â ¹«¾ùÀΰ¡¿ä?[9]     splo1208
09/20 5316
3003   ÀΰøÁö´É ÇÁ·Î±×·¥À» ¸¸µé±â À§ÇØ ¾î¶² Áغñ(?)°¡ ÇÊ¿äÇÑ°¡¿ä?[4]     ERIC910903
04/24 5296
3002     [re] C¾ð¾î¿Í ¸®´ª½º Ã¥ Á» ÃßõÇØÁֽñæ...[1]     ¼ÒÀ¯
09/18 5293
3001   ÀÚ¹Ù GUI Ã¥ Ãßõ[1]     benkim
05/16 5284
3000   °íµîÇлý ÇÁ·Î±×·¡¹Ö ´ëȸ°°Àº °Í ¾ø³ª¿ä?[3]     gkswls123
03/23 5284
2999     [re] ÄíÅ°&¼¼¼Ç ½ºÇªÇÎ? ÇÏÀÌÁ§Å·?[3]     ¼Û½Ã
11/16 5275
2998   C¾ð¾î ¼Ò½ºÁú¹®ÀÔ´Ï´Ù![5]     an0088
01/05 5265
2997   ¸®´ª½º ±â¹Ý ¼ÒÄÏ ÇÁ·Î±×·¡¹Ö ¼ÒÄÏÇÁ·Î±×·¡¹Ö ´ë¼Ò¹®ÀÚ º¯È¯ÇÏ°í½ÍÀºµ¥ ¾îµðÀ§Ä¡¿¡´Ù°¡³ÖÁÒ?´äº¯ºÎŹÇØ¿ä ¤Ð¤Ð°í¼ö´Ôµé[5]     kiskind
10/02 5260
  C¾ð¾î·Î§ ´ÙÇ×½ÄÀÔ´Ï´Ù. ÀßÇϽôºР¼Ò½ºÇؼ®Á»;;;     ddrsinger
04/07 5257
2995   system()ÇÔ¼ö°¡...[4]     badboy25
10/28 5252
2994   C¾ð¾î µ¶ÇÐÇغ¸°íÀÚ ÇÕ´Ï´Ù.[7]     jang976
02/05 5249
2993   c¾ð¾î ÇÔ¼ö Áß¿¡¼­...[4]     jsw0441
06/17 5245
2992   C¿¡¼­ À½¾Ç ³Ö±â[8]     qkreoghks00
12/05 5244
2991     [re] C¾ð¾î ¸»Àä..^^;     yl
09/06 5242
2990   Áú¹®ÀÌ¿µ     blue_star
09/08 5226
2989   ÇϳëÀÌž c++[1]     jkh0721
03/26 5224
2988   c¾ð¾î ÇÒ ¶¼ ¶ç¾î ¾²±â¿¡ °üÇÑ Áú¹®ÀÔ´Ï´Ù[3]     gkswls123
07/25 5210
2987   (char*)&integer....[3]     soul214
06/26 5209
2986   ¸Þ½ÃÁöº°ÄªÀ̳×Æ®¿öÅ©¿¡¾ø½À´Ï´Ù[2]     parjo1201
01/10 5208
2985   ¹®Á¦ °Ë»ç ÇØÁÖ¼¼¿ä ¤Ð[5]     benkim
06/09 5163
[1].. 11 [12][13][14][15][16][17][18][19][20]..[161]

Copyright 1999-2024 Zeroboard / skin by Hackerschool.org / Secure Patch by Hackerschool.org