Hisworld.tistory.com
The hisWorld
(140)
hisworld_new
(0)
hisOld
(138)
Android
(7)
Computer Vision
(18)
JAVA
(4)
C/C++
(26)
열혈강의 C
(32)
TCP/IP socket
(12)
WinAPI
(16)
System Programming
(0)
etc
(23)
Plan
(0)
hisWorld
(0)
hiStory
(0)
hiStudy
(0)
hiSnap
(0)
홈
태그
미디어로그
위치로그
방명록
Windows Live Messenger
winapi
Join C
대학생 공모전
The Turing test page
훈스닷넷
C/C++ Reference
WIKI
/
/
블로그 내 검색
열혈강의 C 도전 프로그래밍 FOUR - 3
URUZ-7
2008. 2. 15. 13:40
2008. 2. 15. 13:40
복소수를 표현하는 구조체 정의 덧셈과 곳셈을 위한 함수 정의하여 입력받아 연산 결과 출력
#include <stdio.h> void add(struct bok *ins); void mux(struct bok *ins); struct bok { double a; double b; }; int main(void) { struct bok ins[2]; fputs("복소수 입력1(실수 허수): ",stdout); scanf("%lf %lf",&ins[0].a,&ins[0].b); fputs("복소수 입력2(실수 허수): ",stdout); scanf("%lf %lf",&ins[1].a,&ins[1].b); add(ins); mux(ins); return 0; } void add(struct bok *ins) { printf("합의 결과] 실수부:%lf, 허수부:%lf\n",(ins[0].a+ins[1].a),(ins[0].b+ins[1].b)); } void mux(struct bok *ins) { printf("곱의 결과] 실수부:%lf, 허수부:%lf\n",((ins[0].a*ins[1].a)-(ins[0].b*ins[1].b)),((ins[0].b*ins[1].a)+(ins[0].a*ins[1].b)) ); }
invalid-file
공유하기
게시글 관리
Hisworld.tistory.com
+ Recent posts
Powered by
Tistory
, Designed by
wallel
Rss Feed
and
Twitter
,
Facebook
,
Youtube
,
Google+
티스토리툴바