Turbo-C
C++Builder  |  Delphi  |  FireMonkey  |  C/C++  |  Free Pascal  |  Firebird
볼랜드포럼 BorlandForum
 경고! 게시물 작성자의 사전 허락없는 메일주소 추출행위 절대 금지
터보-C 포럼
Q & A
FAQ
팁&트릭
강좌/문서
자료실
Lua 게시판
볼랜드포럼 홈
헤드라인 뉴스
IT 뉴스
공지사항
자유게시판
해피 브레이크
공동 프로젝트
구인/구직
회원 장터
건의사항
운영진 게시판
회원 메뉴
북마크
볼랜드포럼 광고 모집

C/C++ Q/A
[6335] 도와주세요... ㅜ 뭐가 틸렸을까요?
신성공 [kingjun25] 11894 읽음    2009-06-08 21:33
계산기인데요...

뭐가 틀렸는지 봐주세요.
제멜은 kingjun25@naver.com 입니다 ...ㅜ


/* Example 017 2009.6.4 Call by Reference II */

#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <bios.h>

int I, J;
int P1, P2;
int SL;
char CA[10],CB[10],CC[10];
char TP;
float DB,DC,DT;

void InitVar(void);
void NumberInput(int);

main(void)
{
    clrscr();
    NumberInput(1);

    if ((TP=='+')||(TP=='-')||(TP=='*')||(TP=='/')) {
    switch(TP)
    case '+' : SL = 1; break;
    case '-' : SL = 2; break;
    case '*' : SL = 3; break;
    case '/' : SL = 4; break;
    }

    goto AA12;

AA12:    gotoxy(1,3); printf("Inputed=%9.3f",DB);
    gotoxy(1,4); printf("    SL  =%1d",SL);

//2nd Numner
    NumberInput(2);
    if ((TP== '=')||(TP==0x0D))    goto AA22;

AA22:
    switch(SL) {
    case 1: DT = DB + DC;
        gotoxy(1,10);
        printf("%9.3f = %9.3f + %9.3f",DT,DB,DC);
        break;
        switch(SL) {
    case 2: DT = DB - DC;
        gotoxy(1,10);
        printf("%9.3f = %9.3f - %9.3f",DT,DB,DC);
        break;    switch(SL) {
    case 3: DT = DB * DC;
        gotoxy(1,10);
        printf("%9.3f = %9.3f * %9.3f",DT,DB,DC);
        break;    switch(SL) {
    case 4: DT = DB / DC;
        gotoxy(1,10);
        printf("%9.3f = %9.3f / %9.3f",DT,DB,DC);
        break;
    }

gotoxy(40,1); printf("Bye~!");
getch();
    return(0);

}

void InitVar(void)
    {
       P1 = 0
       P2 = 0
       for (I - 0; I <= 10; I++) {
        CA[I] = 0x0D;
        CB[I] = 0x0D;
        }
       I = 0;
    }

    void NumberInput(int Px)
        {

N11:
    gotoxy(1,(Px-1)*1; TP = getch();
    if ((TP >= '0')&&(TP <= '9')) {
    CA[I] = TP;
    I++;
    gotoxy(10,((Px-1)*1)+2); printf("%s",CA);
    goto N11;
    }

    if (((TP == '.')&&(P1 == 0))||((TP == '.')&&(P2 == 0))) {
        CA[I] = TP;
        I++;
        switch(Px) {
        case 1: P1 = 1; break;
        case 2: P2 = 2; break;
        }
    gotoxy(10,(Px-1)*5+2); printf("%s",CA);
    goto N11;
    }

for (J = 0; J < I; J++) CB[J] = CA[J];

switch(Px) {
    case 1: DB = atof(CB); break;
    case 2: DC = atof(CB); break;
    }
    gotoxy(1,(Px-1)*5+8); printf("Inputed=%9.3f",DC);
}

+ -

관련 글 리스트
6335 도와주세요... ㅜ 뭐가 틸렸을까요? 신성공 11894 2009/06/08
6336     Re:도와주세요... ㅜ 기말고사 레포트인데요..에러가;; Intotheblue 10064 2009/06/08
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.