-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
40 lines (31 loc) · 824 Bytes
/
main.cpp
File metadata and controls
40 lines (31 loc) · 824 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include <iostream>
#include "lib.h"
/*
* ‡ ¯à®á¨âì ª®«-¢® í«¥¬¥â®¢ ¬ áᨢ ã ¯®«ì§®¢ ⥫ï
* ®áç¨â âì á㬬ã
* ‚뢥áâ¨
*/
using namespace std;
unsigned int n = 0;
int *pointer = nullptr;
int main() {
/* ‡ ¯à®á í«¥¬¥â®¢*/
cout << "‚¢¥¤¨â¥ ª®«-¢® í«¥¬¥â®¢ ¡ã¤ã饣® ¬ áᨢ : \n";
cin >> n;
/*‘®§¤ ¨¥ ¬ áᨢ ¨ § ¯à®á i-£® í«¥¬¥â */
pointer = new int[n];
for (unsigned int i = 0; i < n; i++){
cout << "‚¢¥¤¨â¥ " << (i + 1) << " í«¥«¥¬¥â \n";
cin >> pointer[i];
}
/*‚뢮¤ ¨â®£®¢®£® ¬ áᨢ */
for (unsigned int i = 0; i < n; i++){
cout << pointer[i] << " ";
}
cout << "\n";
/*®¤áç¥â áã¬¬ë ¨ ¢ë¢®¤ ®â¢¥â */
cout << "‘㬬 ¢á¥å í«¥¬¥â®¢ ¬ áᨢ = " << sum(pointer, n);
/*Žá¢®¡®¦¤¥¨¥ ¯ ¬ïâ¨*/
delete [] pointer;
return 0;
}