[콤퓨터공학]함수를 결정하는 프로그래밍
- 최초 등록일
- 2006.09.16
- 최종 저작일
- 2006.05
- 3페이지/ 한컴오피스
- 가격 1,500원
소개글
함수를 결정하는 프로그래밍 (c언어로 작성)
목차
없음
본문내용
30. f를 집합 A=S6에 관한 함수라고 할 때,
(1) f[A]
(2) fof = f²
(3) 함수 f의 단사 함수 여부
를 결정하는 프로그램을 작성하고, 다음 데이터를 이용하여 테스트하여라.
(a) f={ (1,4), (4,3), (2,3), (6,5), (3,4), (5,6) }
(b) f={ (1,5), (2,3), (6,4), (4,1), (3,2), (5,1) }
◆ 코딩내용
◆ 실행화면
#include <stdio.h>
void main()
{
printf("S = { 1, 2, 3, 4, 5, 6 }\n");
// mathfuncFst, fstdataSave 는 함수의 정의역
// mathfuncSec, secdataSave 는 함수의 치역
int mathfuncFst[6], mathfuncSec[6], fstdataSave[6], secdataSave[6];
int repeati, repeatj;
//// f의 원소를 입력 //////////////////////////////////////////////
for ( repeati=0; repeati<6; repeati++ )
{
printf("(x,y)일때 x입력 : ");
scanf("%d",&mathfuncFst[repeati]);
fstdataSave[repeati] = mathfuncFst[repeati];
printf("(x,y)일때 y입력 : ");
scanf("%d",&mathfuncSec[repeati]);
secdataSave[repeati] = mathfuncSec[repeati];
}
//// (1) f[A] /////////////////////////////////////////////////////
int setnum;
printf("\n(1) f[A] = {");
for( setnum=1; setnum<=6; setnum++ )
참고 자료
없음