Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 81336ee063 | |||
| d9083cf4c1 | |||
| 1e431c8f1e |
57
.clang-format
Normal file
57
.clang-format
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
---
|
||||||
|
Language: Cpp
|
||||||
|
BasedOnStyle: LLVM
|
||||||
|
AccessModifierOffset: -4
|
||||||
|
AlignConsecutiveAssignments: false
|
||||||
|
AlignConsecutiveDeclarations: false
|
||||||
|
AlignOperands: true
|
||||||
|
AlignTrailingComments: false
|
||||||
|
AlwaysBreakTemplateDeclarations: Yes
|
||||||
|
BraceWrapping:
|
||||||
|
AfterCaseLabel: false
|
||||||
|
AfterClass: false
|
||||||
|
AfterControlStatement: false
|
||||||
|
AfterEnum: false
|
||||||
|
AfterFunction: false
|
||||||
|
AfterNamespace: false
|
||||||
|
AfterStruct: false
|
||||||
|
AfterUnion: false
|
||||||
|
AfterExternBlock: false
|
||||||
|
BeforeCatch: false
|
||||||
|
BeforeElse: false
|
||||||
|
BeforeLambdaBody: false
|
||||||
|
BeforeWhile: false
|
||||||
|
SplitEmptyFunction: true
|
||||||
|
SplitEmptyRecord: true
|
||||||
|
SplitEmptyNamespace: true
|
||||||
|
BreakBeforeBraces: Custom
|
||||||
|
BreakConstructorInitializers: AfterColon
|
||||||
|
BreakConstructorInitializersBeforeComma: false
|
||||||
|
ColumnLimit: 240
|
||||||
|
ConstructorInitializerAllOnOneLineOrOnePerLine: false
|
||||||
|
ContinuationIndentWidth: 8
|
||||||
|
IncludeCategories:
|
||||||
|
- Regex: '^<.*'
|
||||||
|
Priority: 1
|
||||||
|
- Regex: '^".*'
|
||||||
|
Priority: 2
|
||||||
|
- Regex: '.*'
|
||||||
|
Priority: 3
|
||||||
|
IncludeIsMainRegex: '([-_](test|unittest))?$'
|
||||||
|
IndentCaseLabels: true
|
||||||
|
IndentWidth: 4
|
||||||
|
InsertNewlineAtEOF: true
|
||||||
|
MacroBlockBegin: ''
|
||||||
|
MacroBlockEnd: ''
|
||||||
|
MaxEmptyLinesToKeep: 2
|
||||||
|
NamespaceIndentation: All
|
||||||
|
SpaceAfterCStyleCast: true
|
||||||
|
SpaceAfterTemplateKeyword: false
|
||||||
|
SpaceBeforeRangeBasedForLoopColon: false
|
||||||
|
SpaceInEmptyParentheses: false
|
||||||
|
SpacesInAngles: false
|
||||||
|
SpacesInConditionalStatement: false
|
||||||
|
SpacesInCStyleCastParentheses: false
|
||||||
|
SpacesInParentheses: false
|
||||||
|
TabWidth: 4
|
||||||
|
...
|
||||||
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,3 +1,4 @@
|
|||||||
*.zip
|
*.zip
|
||||||
*.exe
|
*.exe
|
||||||
*.o
|
*.o
|
||||||
|
.idea/
|
||||||
29
01/bmi.c
29
01/bmi.c
@ -1,4 +1,31 @@
|
|||||||
/*************************************************************************************************
|
/*************************************************************************************************
|
||||||
* Schreiben Sie ein Programm, das das Gewicht in kg und die Groesse in cm einliest und dann den *
|
* Schreiben Sie ein Programm, das das Gewicht in kg und die Groesse in cm einliest und dann den *
|
||||||
* Body Mass Index mit zwei Nachkommastellen ausgibt (bmi = gewicht / (groesse in m)²). *
|
* Body Mass Index mit zwei Nachkommastellen ausgibt (bmi = gewicht / (groesse in m)²). *
|
||||||
*************************************************************************************************/
|
*************************************************************************************************/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
unsigned int gewicht_kg = 0;
|
||||||
|
unsigned int groesse_cm = 0;
|
||||||
|
|
||||||
|
printf("Geben sie ihr Gewicht in Kg ein: ");
|
||||||
|
scanf("%d", &gewicht_kg);
|
||||||
|
|
||||||
|
printf("Geben sie Ihre Groesse in cm: ");
|
||||||
|
scanf("%d", &groesse_cm);
|
||||||
|
|
||||||
|
printf("Gewicht: %i Kg\n", gewicht_kg);
|
||||||
|
printf("Groesse: %i cm\n", groesse_cm);
|
||||||
|
|
||||||
|
double bmi = gewicht_kg / ((groesse_cm / 100.f) * (groesse_cm / 100.f));
|
||||||
|
printf("Fuer ein Gewicht mit %d Kg und %d cm lautet der BMI: %.2lf\n", gewicht_kg, groesse_cm, bmi);
|
||||||
|
if (bmi < 18.5)
|
||||||
|
printf("Das ist untergewichtig!");
|
||||||
|
else if (bmi > 25)
|
||||||
|
printf("Das ist uebergewichtig!");
|
||||||
|
else
|
||||||
|
printf("Das ist Normalgewicht.");
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user