-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVAR10_array
More file actions
58 lines (42 loc) · 948 Bytes
/
VAR10_array
File metadata and controls
58 lines (42 loc) · 948 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
54
55
56
57
58
Bsp1.: Dieser Code findet die geringste zahl in einem array
/*#include <iostream>
using namespace std;
int main() {
int werte[10]={7,3,1,27,8,6,12,4,9,14};
int j=0;
for ( int i=0; i<10; i++)
//{
//cout << werte[i] << ",";
//}
//cout << endl;
if ( werte[i] < werte[j] )
{
j=i;
//j=i+1;
}
cout << werte[j]<<endl;
return 0;
}*/
//Bsp2.: Sortieralgorithmus
#include <iostream>
using namespace std;
int main() {
int werte[10]={7,3,1,27,8,6,12,4,9,14};
for ( int i=0; i<10; i++)
{
cout << werte[i] << ",";
}
cout << endl;
for (int i=0; i<9;i++)
{
int wertesort=werte[i];
werte[i]= werte[9-i];
werte[9-i]=wertesort;
}
//(wertesort>werte[i+1])
for ( int i=0; i<10; i++)
{
cout << i << werte[i] << "," << endl;
}
return 0;
}