-
Notifications
You must be signed in to change notification settings - Fork 36
Expand file tree
/
Copy patharray.cc
More file actions
53 lines (46 loc) · 1017 Bytes
/
array.cc
File metadata and controls
53 lines (46 loc) · 1017 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
41
42
43
44
45
46
47
48
49
50
51
52
53
#include <iostream>
#include <string>
#include <vector>
int main()
{
const unsigned cnt = 5;
constexpr unsigned sz = 42;
int arr[cnt] = {190, 23, 54};
int sum = 0;
for (int i : arr)
{
sum += i;
}
std::cout << "The sum is " << sum << std::endl;
std::string bad[cnt];
for (int i=0; i<cnt; i++)
{
std::cout << arr[i] << " ";
}
std::cout << std::endl;
std::string *parr[sz];
int a5[2] = {0,1};
int a3[5] = {0,1,2};
std::string a4[3] = {"hi","bye"};
char a1[] = {'C','+','+'};
char a2[] = {'C','+','+','\0'};
char a6[] = "C++";
const char a7[7] = "Daniel";
int b[] = {0, 1, 2};
int *ptrs[10];
int (&refs)[3] = b;
int (*Parray)[3] = &b;
unsigned scores[11] = {};
unsigned grade;
while (std::cin >> grade)
{
if (grade <= 100)
++scores[grade/10];
}
for (auto i : scores)
{
std::cout << i << " ";
}
std::cout << std::endl;
return 0;
}