다항식 연산
- 최초 등록일
- 2006.12.23
- 최종 저작일
- 2006.01
- C언어
- 가격 2,000원
소개글
이 프로그램은 C로 코딩한 다항식 연산 프로그램입니다. 항을 추가 또는 삭제할 수도 있고
예를 들면 2X^2 + 3Y - 4 = 0 와 3X^2 - 2Y + 3 = 0 이 두식에서 X,Y를 구할 수 있는 프로그램
입니다.
컴파일 실행환경
Visual studio
본문내용
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
#include <math.h>
//다항식 설정
typedef struct polyList
{
int exp ;
float coef ;
struct polyList *link ;
}polyList ;
//헤더
typedef struct
{
polyList *head ;
}poly_h ;
//함수 선언
void menu() ;
poly_h *zeroP() ;
int isZeroP(poly_h *L) ;
float coef(poly_h *L,int e) ;
int maxExp(poly_h *L) ;
void addTerm(poly_h *L, float c, int e) ;
poly_h *delTerm(poly_h *L,int e) ;
poly_h *sMult(poly_h *L, float c, int e) ;
poly_h *PolyAdd(poly_h *L1, poly_h *L2) ;
poly_h *PolyMult(poly_h *L1, poly_h *L2) ;
void copyList(poly_h *L1, poly_h *L2) ;
void printList(poly_h *L) ;
poly_h *inputPoly() ;
void calList() ;
//입력
int input = 0 ;
// 다항식 생성
poly_h *PL1 ;
poly_h *PL2 ;
int main()
{
menu() ;
return 0 ;
}
void menu()
{
float c = 0;
int e = 0 ;
polyList * p ;
while(1)
{
system("cls") ;
printf("==== 메뉴 ====\n");
printf("1. 다항식 입력\n");
printf("2. 다항식 출력\n");
printf("3. 항 추가\n") ;
printf("4. 항 삭제\n");
printf("5. 항 수정\n");
printf("6. 다항식 덧셈\n");
printf("7. 다항식 곱셈\n");
printf("8. 다항식 계산\n");
printf("9. 종료\n");
참고 자료
없음