종합적인.. > C , C++

본문 바로가기
사이트 내 전체검색

C , C++

종합적인..

페이지 정보

profile_image
작성자 이즈
댓글 0건 조회 2,488회 작성일 06-01-18 04:21

본문

// private:  public:

#include<iostream>
#include<conio.h>

using namespace std;

class A
{
int x;
int y;
char yon;
int tot;
public:
A();
void sum();
void disp()
{
cout << x <<" " << yon << " " << y <<" = " << tot <<endl;
}
};

A::A()
{
cout << " x = ";
cin >> x;
cout << " yon = ";
cin >> yon;
fflush(stdin); // 버퍼 삭제
cout << " y = ";
cin >> y;
}

void A::sum()
{
switch(yon)
{
case '+':tot =x + y; break;
case '-':tot =x - y; break;
case '*':tot =x * y; break;
case '/':tot =x / y; break;
case '%':tot =x % y; break;
default : cout << " error .." <<endl;
exit(0);
}
}
void main()
{
A cc;
cc.sum();
cc.disp();

getch();
}

댓글목록

등록된 댓글이 없습니다.

Total 246건 10 페이지
C , C++ 목록
번호 제목 글쓴이 조회 날짜
102 이즈 3775 01-20
101 이즈 6857 01-19
100 이즈 2772 01-18
열람중 이즈 2489 01-18
98 이즈 4160 01-18
97 이즈 4816 01-18
96 이즈 4320 01-16
95 이즈 3420 01-16
94 이즈 3395 01-16
93 이즈 2902 01-15
92 이즈 3607 01-14
91 이즈 3197 01-12
90 이즈 5179 01-12
89 이즈 4267 01-12
88 이즈 15054 01-12
87 이즈 8910 01-12

검색

회원로그인

회원가입

사이트 정보

컴퓨터 정보,윈도우즈,리눅스,포토샵,3ds
맥스,프로그래밍 강좌팁

접속자집계

오늘
685
어제
724
최대
5,287
전체
637,684
Copyright © www.qdata.co.kr All rights reserved.