Contents

Develop
2003.04.23 09:50

[c++] p.118 확인학습 5번

Views 10773 Comment 0
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print
#include<iostream.h>

class summation{
        int num;
        long sum;
        public:
        void set_sum(int n);
        void show_sum(){
                cout << num << " summed is " << sum << "n";
        }
};

void summation::set_sum(int n){
        int i;
        num=n;
        sum=0;
        for(i=1;i<=n;i++) sum+=i;
}

summation make_sum(int num){
        summation ob;
        ob.set_sum(num);
        return ob;
}

int main(){
        int num;
        summation ob;

        cout << "Enter a number : ";
        cin >> num;
         
        ob = make_sum(num);
        ob.show_sum();

        return 0;

?

List of Articles
No. Category Subject Author Date Views
165 System/OS [router] 시스코 라우터 명령어 모드.. hooni 2013.04.23 13009
164 Algorithm [security] RSA 암호화 설명과 예.. hooni 2013.04.23 16691
163 Algorithm [security] 블럭 암호에 대해서.. hooni 2013.04.23 17189
162 Develop [sh] html 안에 있는 img 다운 받는 쉘 스크립트 file hooni 2020.05.26 763
161 Develop [sh] 쉘스크립트 if 비교 연산 hooni 2020.05.26 60985
160 Develop [spring] 스프링 IoC/DI hooni 2013.04.23 11409
159 System/OS [sql] alter table 쿼리 예제 hooni 2003.04.23 12523
158 System/OS [sql] insert into select 사용하기 hooni 2013.04.23 27640
157 Database [sql] 간단한 SQL 문법 정리 hooni 2003.04.23 12626
156 Database [sql] 간단한 통계 서브쿼리 예제.. hooni 2013.04.23 15171
155 System/OS [sql] 내 방명록 답글 찾는 쿼리문.. (JOIN 구문) hooni 2003.04.23 12931
154 System/OS [sql] 조회구문(select)에서 중복 데이터를 한 번만 출력 (distinct) 1 hooni 2013.04.23 34066
Board Pagination Prev 1 ... 80 81 82 83 84 85 86 87 88 89 ... 98 Next
/ 98