Contents

Develop
2003.04.23 09:50

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

Views 11939 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
1153 System/OS [펌] 마이크로서비스, 모노리포, SRE, ... 덮어놓고 구글 따라하면 안 되는 기술들 file hooni 2020.10.15 3355
1152 Develop [js] Text 값을 클립보드에 복사하기 hooni 2020.10.10 2734
1151 System/OS Apache CORS 설정 1 hooni 2020.09.04 6137
1150 System/OS How to Install and Use wget on Mac file hooni 2020.09.03 5592
1149 System/OS [mac] VirtualBox 실행 스크립트와 bash_profile 설정 file hooni 2020.07.08 3346
1148 System/OS [linux] wget 명령 사용 예제 hooni 2020.05.26 4100
1147 System/OS [linux] The Ultimate Wget Download Guide With 15 Awesome Examples hooni 2020.05.26 3688
1146 Develop [sh] 쉘스크립트 if 비교 연산 hooni 2020.05.26 64347
1145 Develop [sh] html 안에 있는 img 다운 받는 쉘 스크립트 file hooni 2020.05.26 2565
1144 Develop [ios] Start developing your navigation app for CarPlay without enrollment file hooni 2020.02.22 132746
1143 System/OS Configure Postfix to Use Gmail SMTP on Ubuntu 18.04 file hooni 2020.02.07 12207
1142 System/OS RPA란? 어디에 어떻게 쓰이고 누가 만드나? file hooni 2020.01.28 3202
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 ... 99 Next
/ 99