[프로그래밍 C언어] 사칙연산 프로그램
- 최초 등록일
- 2002.10.09
- 최종 저작일
- 2002.10
- 4페이지/ C언어
- 가격 1,000원
목차
사칙연산 C파일 입니다.
본문내용
#include<stdio.h>
double double_count(double ,double ,char ); // double형 사칙연산 함수 선언
float float_count(float ,float ,char ); // float형 사칙연산 함수 선언
int int_count(int ,int ,char ); // int형 사칙연산 함수 선언
int input_operand(double *); // 숫자입력과 에러 처리 함수 선언
int input_operator(char *); // 연산자 입력과 에러 처리 함수 선언
void main(void){ // main함수
double operand1=0,operand2=0,operand3=0; // 피연산자 정의(double형)
char operator1=0,operator2=0; // 연산자 정의
int err_find; // 에러값을 저장하는 변수
int int_result=0; // int형의 계산 결과를 저장할 변수
float float_result=0; // float형의 계산 결과를 저장할 변수
double double_result=0; // double형의 계산 결과를 저장할 변수
// 숫자와 연산자를 정확히 입력할때 까지 계속 반복
while(1) {
// 숫자가 아닌것을 입력 했을 때 0을 리턴
err_find = input_operand(&operand1);
if(err_find==0) // 0일 경우 루프의 처음으로 이동
continue;
// 연산자가 아닌것을 입력 했을 때 0을 리턴
err_find = input_operator(&operator1);
if(err_find==0) // 0일 경우 루프의 처음으로 이동
continue;
참고 자료
없음