Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Tobias Allrich
Unistuff
Commits
7e2c6cd7
Commit
7e2c6cd7
authored
Dec 09, 2019
by
Tobias.Allrich
Browse files
Added
+ 6-1.cpp + 6-2.cpp + 6-3.cpp Improved + 5-3.cpp Changed name of old file
parent
258d6458
Changes
7
Hide whitespace changes
Inline
Side-by-side
GI/Inf1/5-3.cpp
View file @
7e2c6cd7
...
...
@@ -14,7 +14,11 @@ int main()
for
(
int
i
=
0
;
i
<
g
;
i
++
)
{
cout
<<
"Wert "
<<
i
+
1
<<
" : "
;
cout
<<
"Wert "
;
cout
.
width
(
3
);
cout
<<
i
+
1
;
cout
.
fill
(
' '
);
cout
<<
" : "
;
cin
>>
a
[
i
];
}
...
...
GI/Inf1/6-1.cpp
0 → 100644
View file @
7e2c6cd7
#include
<iostream>
using
namespace
std
;
int
main
()
{
// Richtig :
int
sudoku
[
9
][
9
]
=
{{
7
,
6
,
5
,
4
,
1
,
2
,
9
,
3
,
8
},
{
1
,
8
,
2
,
9
,
5
,
3
,
4
,
7
,
6
},
{
3
,
9
,
4
,
7
,
6
,
8
,
1
,
5
,
2
},
{
8
,
1
,
6
,
3
,
2
,
9
,
5
,
4
,
7
},
{
9
,
4
,
3
,
8
,
7
,
5
,
6
,
2
,
1
},
{
2
,
5
,
7
,
6
,
4
,
1
,
8
,
9
,
3
},
{
4
,
2
,
9
,
1
,
8
,
7
,
3
,
6
,
5
},
{
5
,
3
,
8
,
2
,
9
,
6
,
7
,
1
,
4
},
{
6
,
7
,
1
,
5
,
3
,
4
,
2
,
8
,
9
}};
// Falsch :
//int sudoku[9][9] = {{7,6,5,4,1,2,9,3,8}, {1,8,2,9,5,3,4,8,6}, {3,9,4,7,6,8,1,5,2}, {8,1,6,3,2,9,5,4,7}, {9,4,3,8,7,5,6,2,1}, {2,5,7,6,4,1,8,9,3}, {4,2,9,1,8,2,3,6,5}, {5,3,8,2,9,6,7,1,4}, {6,7,1,5,3,4,2,8,9}};
bool
test
=
true
;
int
ze
[
9
]
=
{
0
},
sp
[
9
]
=
{
0
},
ind
;
//Eingabe
/*
for(int i = 0; i < 9; i++)
{
for(int j = 0; j < 9; j++)
{
cout<<"Zeile "<<i<<" , Spalte "<<j<<" : ";
cin>>sudoku[i][j];
if(sudoku[i][j] < 1 || sudoku[i][j] > 9) return 1;
}
}
*/
for
(
int
i
=
0
;
i
<
9
;
i
++
)
{
for
(
int
j
=
0
;
j
<
9
;
j
++
)
{
ze
[
j
]
=
sudoku
[
i
][
j
];
}
ind
=
0
;
for
(
int
z
=
1
;
z
<=
9
;
z
++
)
{
for
(
int
j
=
0
;
j
<
9
;
j
++
)
{
if
(
ze
[
j
]
==
z
&&
ind
<
z
)
{
ind
++
;
}
}
}
if
(
ind
!=
9
)
{
cout
<<
"Sudoku falsch!"
;
return
0
;
}
}
for
(
int
i
=
0
;
i
<
9
;
i
++
)
{
for
(
int
j
=
0
;
j
<
9
;
j
++
)
{
sp
[
j
]
=
sudoku
[
j
][
i
];
}
ind
=
0
;
for
(
int
z
=
1
;
z
<=
9
;
z
++
)
{
for
(
int
j
=
0
;
j
<
9
;
j
++
)
{
if
(
sp
[
j
]
==
z
&&
ind
<
z
)
{
ind
++
;
}
}
}
if
(
ind
!=
9
)
{
cout
<<
"Sudoku falsch!"
;
return
0
;
}
}
cout
<<
"Sudoku richtig."
;
return
0
;
}
GI/Inf1/6-2.cpp
View file @
7e2c6cd7
#include
<iostream>
#include
<cmath>
using
namespace
std
;
struct
coord
int
main
()
{
int
x
;
int
y
;
};
int
a
[
5
][
3
],
b
[
5
][
3
],
c
[
5
][
3
];
int
main
(
void
)
{
coord
p
[
10
];
int
tmpw
=
0
,
tmpn
=
0
;
float
a
[
10
];
for
(
int
i
=
0
;
i
<
10
;
i
++
)
//A einlesen
for
(
int
i
=
0
;
i
<
5
;
i
++
)
{
cout
<<
"Punkt "
<<
i
+
1
<<
" eingeben
\n
"
;
cin
>>
p
[
i
].
x
;
cin
>>
p
[
i
].
y
;
cout
<<
"----------
\n
"
;
for
(
int
j
=
0
;
j
<
3
;
j
++
)
{
cout
<<
"Zeile "
<<
i
+
1
<<
", Spalte "
<<
j
+
1
<<
" : "
;
cin
>>
a
[
i
][
j
];
//Quadrate in B speichern
b
[
i
][
j
]
=
a
[
i
][
j
]
*
a
[
i
][
j
];
//C berechnen
c
[
i
][
j
]
=
a
[
i
][
j
]
+
b
[
i
][
j
];
}
}
for
(
int
i
=
0
;
i
<
10
;
i
++
)
{
/* if(p[i].x < 0) p[i].x *= -1;
if(p[i].y < 0) p[i].y *= -1; */
a
[
i
]
=
sqrt
(
p
[
i
].
x
*
p
[
i
].
x
+
p
[
i
].
y
*
p
[
i
].
y
);
if
(
a
[
i
]
>
a
[
tmpw
])
tmpw
=
i
;
if
(
a
[
i
]
<
a
[
tmpn
])
tmpn
=
i
;
//Spaltensummen
cout
<<
"
\n\n
Spaltensummen:
\n
"
;
for
(
int
i
=
0
;
i
<
3
;
i
++
)
{
int
sum
=
0
;
for
(
int
j
=
0
;
j
<
5
;
j
++
)
{
sum
+=
a
[
j
][
i
];
}
cout
<<
"Summe Spalte "
<<
i
+
1
<<
" : "
<<
sum
<<
"
\n
"
;
}
cout
<<
"Näheste Punkt: "
<<
p
[
tmpn
].
x
<<
" "
<<
p
[
tmpn
].
y
<<
"
\n
Weiterster Punkt: "
<<
p
[
tmpw
].
x
<<
" "
<<
p
[
tmpw
].
y
;
//Ausgabe C
cout
<<
"
\n\n
Matrix C:
\n
"
;
for
(
int
i
=
0
;
i
<
5
;
i
++
)
{
for
(
int
j
=
0
;
j
<
3
;
j
++
)
{
cout
<<
c
[
i
][
j
]
<<
"
\t
"
;
}
cout
<<
"
\n
"
;
}
return
0
;
}
GI/Inf1/6-3.cpp
View file @
7e2c6cd7
#include
<iostream>
#include
<cmath>
using
namespace
std
;
struct
coord
int
main
()
{
int
x
;
int
y
;
};
struct
kreis
{
coord
xy
;
float
r
;
};
int
main
(
void
)
{
coord
p
;
kreis
k
;
cout
<<
"Kreiskoordinaten eingeben (X,Y,r)
\n
"
;
cin
>>
k
.
xy
.
x
>>
k
.
xy
.
y
>>
k
.
r
;
cout
<<
"Punktkoordinaten eingeben (X,Y)
\n
"
;
cin
>>
p
.
x
>>
p
.
y
;
if
(
sqrt
((
p
.
x
-
k
.
xy
.
x
)
*
(
p
.
x
-
k
.
xy
.
x
)
+
(
p
.
y
-
k
.
xy
.
y
)
*
(
p
.
y
-
k
.
xy
.
y
))
>
k
.
r
)
cout
<<
"Der Punkt liegt außerhalb des Kreises"
;
else
cout
<<
"Der Punkt liegt innerhalb des Kreises"
;
int
rm
[
6
][
15
]
=
{
0
};
for
(
int
i
=
0
;
i
<
6
;
i
++
)
{
cin
>>
rm
[
i
][
0
];
}
for
(
int
i
=
0
;
i
<
6
;
i
++
)
{
for
(
int
j
=
1
;
j
<
15
;
j
++
)
{
if
(
i
==
0
)
rm
[
i
][
j
]
=
rm
[
i
][
j
-
1
]
+
rm
[
i
+
1
][
j
];
else
{
if
(
i
==
5
)
rm
[
i
][
j
]
=
rm
[
i
][
j
-
1
]
+
rm
[
i
-
1
][
j
-
1
];
else
{
rm
[
i
][
j
]
=
rm
[
i
-
1
][
j
-
1
]
-
rm
[
i
][
j
-
1
]
-
rm
[
i
+
1
][
j
-
1
];
}
}
}
}
for
(
int
i
=
0
;
i
<
6
;
i
++
)
{
for
(
int
j
=
1
;
j
<
15
;
j
++
)
{
cout
<<
rm
[
i
][
j
]
<<
"
\t
"
;
}
cout
<<
"
\n
"
;
}
return
0
;
}
GI/Inf1/WS18_19_Strukturen1.cpp
0 → 100644
View file @
7e2c6cd7
#include
<iostream>
#include
<cmath>
using
namespace
std
;
struct
coord
{
int
x
;
int
y
;
};
int
main
(
void
)
{
coord
p
[
10
];
int
tmpw
=
0
,
tmpn
=
0
;
float
a
[
10
];
for
(
int
i
=
0
;
i
<
10
;
i
++
)
{
cout
<<
"Punkt "
<<
i
+
1
<<
" eingeben
\n
"
;
cin
>>
p
[
i
].
x
;
cin
>>
p
[
i
].
y
;
cout
<<
"----------
\n
"
;
}
for
(
int
i
=
0
;
i
<
10
;
i
++
)
{
/* if(p[i].x < 0) p[i].x *= -1;
if(p[i].y < 0) p[i].y *= -1; */
a
[
i
]
=
sqrt
(
p
[
i
].
x
*
p
[
i
].
x
+
p
[
i
].
y
*
p
[
i
].
y
);
if
(
a
[
i
]
>
a
[
tmpw
])
tmpw
=
i
;
if
(
a
[
i
]
<
a
[
tmpn
])
tmpn
=
i
;
}
cout
<<
"Näheste Punkt: "
<<
p
[
tmpn
].
x
<<
" "
<<
p
[
tmpn
].
y
<<
"
\n
Weiterster Punkt: "
<<
p
[
tmpw
].
x
<<
" "
<<
p
[
tmpw
].
y
;
return
0
;
}
GI/Inf1/WS18_19_Strukturen2.cpp
0 → 100644
View file @
7e2c6cd7
#include
<iostream>
#include
<cmath>
using
namespace
std
;
struct
coord
{
int
x
;
int
y
;
};
struct
kreis
{
coord
xy
;
float
r
;
};
int
main
(
void
)
{
coord
p
;
kreis
k
;
cout
<<
"Kreiskoordinaten eingeben (X,Y,r)
\n
"
;
cin
>>
k
.
xy
.
x
>>
k
.
xy
.
y
>>
k
.
r
;
cout
<<
"Punktkoordinaten eingeben (X,Y)
\n
"
;
cin
>>
p
.
x
>>
p
.
y
;
if
(
sqrt
((
p
.
x
-
k
.
xy
.
x
)
*
(
p
.
x
-
k
.
xy
.
x
)
+
(
p
.
y
-
k
.
xy
.
y
)
*
(
p
.
y
-
k
.
xy
.
y
))
>
k
.
r
)
cout
<<
"Der Punkt liegt außerhalb des Kreises"
;
else
cout
<<
"Der Punkt liegt innerhalb des Kreises"
;
return
0
;
}
GI/Inf1/
6-5
.cpp
→
GI/Inf1/
WS18_19_Strukturen3
.cpp
View file @
7e2c6cd7
File moved
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment