Skip to content

Commit

Permalink
Aufgabe 4 Bearbeitet und fertiggestellt
Browse files Browse the repository at this point in the history
  • Loading branch information
Arthur Leon Dyga committed Nov 17, 2022
1 parent 3746039 commit b46126f
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 50 deletions.
53 changes: 4 additions & 49 deletions 3Datentypkonvertierung/Program.cs
Original file line number Diff line number Diff line change
@@ -1,51 +1,6 @@
//Arbeitsauftrag 1
int Short = 2 * 8; //bytes x 8
int Integer = 4 * 8;
int Long = 8 * 8;
int Float = 4 * 8;
int Double = 8 * 8;
int Decimal = 16 * 8;
Console.WriteLine($"Short:{Short} Bits / {typeof(short)} hat {sizeof(short)} Bytes / MinValue: {short.MinValue} / MaxValue: {short.MaxValue}");
Console.WriteLine($"int:{Integer} Bits {typeof(int)} hat {sizeof(int)} Bytes / MinValue: {int.MinValue} / MaxValue: {int.MaxValue}");
Console.WriteLine($"long:{Long} Bits {typeof(long)} hat {sizeof(long)} Bytes / MinValue: {long.MinValue} / MaxValue: {long.MaxValue}");
Console.WriteLine($"float:{Float} Bits {typeof(float)} hat {sizeof(float)} Bytes / MinValue: {float.MinValue} / MaxValue: {float.MaxValue}");
Console.WriteLine($"double:{Double} Bits {typeof(double)} hat {sizeof(double)} Bytes / MinValue: {double.MinValue} / MaxValue: {double.MaxValue}");
Console.WriteLine($"decimal:{Decimal} Bits {typeof(decimal)} hat {sizeof(decimal)} Bytes / MinValue: {decimal.MinValue} / MaxValue: {decimal.MaxValue}");
Console.WriteLine(" ");
Console.WriteLine(" ");
Console.WriteLine(" ");
Console.WriteLine(" ");
string a = "Hallo";
string b = "H";

//Arbeitsauuftrag 2
string Vorname = "Arthur";
short Alter = 15;
bool Ist_CSharp_Die_Erste_Programmiersprache_Die_sie_Lernen = true;
Console.WriteLine($"Vorname: {Vorname}");
Console.WriteLine($"Alter: {Alter}");
Console.WriteLine($"Ist C# Die erste Programmiersprache die sie lernen?: {Ist_CSharp_Die_Erste_Programmiersprache_Die_sie_Lernen}");
Console.WriteLine(" ");
Console.WriteLine(" ");
Console.WriteLine(" ");
Console.WriteLine(" ");
b += "allo";

//Arbeitsauftrag 3
int DollarZahl = 36;
char Dollar = (char)DollarZahl;
Console.WriteLine($"{DollarZahl}{Dollar}");
Console.WriteLine(" ");
Console.WriteLine(" ");
Console.WriteLine(" ");
Console.WriteLine(" ");

//Arbeitsauftrag 4
Console.WriteLine("Zufällige zahl");
string Value1 = Console.ReadLine();
Console.WriteLine("Zufällige Dezimalzahl");
string Value2 = Console.ReadLine();

short Konvertiert1 = Convert.ToInt16(Value1);
double Konvertiert2 = Convert.ToDouble(Value2);

Console.WriteLine($"Erfolgreich {Konvertiert1} zu {typeof(short)} konvertiert");
Console.WriteLine($"Erfolgreich {Konvertiert2} zu {typeof(double)} konvertiert");
Console.ReadLine();
Console.WriteLine(b);
11 changes: 11 additions & 0 deletions 4BMI/4BMI.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<RootNamespace>_4BMI</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

</Project>
24 changes: 24 additions & 0 deletions 4BMI/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
double Gewicht;
double größe;
double BMI;

Console.WriteLine("Gewicht in KG:");
Gewicht = Convert.ToDouble(Console.ReadLine());

Console.WriteLine("Größe in CM:");
größe = Convert.ToDouble(Console.ReadLine());
größe /= 100;

BMI = Gewicht / Math.Pow(größe, 2);
if (BMI < 18.5)
{
Console.WriteLine("Sie sind Untergewichtig.");
}
else if (BMI <= 25)
{
Console.WriteLine("Sie sind Normalgewichtig.");
}
else
{
Console.WriteLine("Sie sind Übergewichtig");
}
8 changes: 7 additions & 1 deletion GrundlagenCSharp.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "1SyntaxCSharp", "1SyntaxCSh
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "3Datentypkonvertierung", "3Datentypkonvertierung\3Datentypkonvertierung.csproj", "{E6A6E114-FA8D-4370-88AB-A8388DC43E34}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "2ConsolenEingbaeAusgabe", "2ConsolenEingbaeAusgabe\2ConsolenEingbaeAusgabe.csproj", "{C46D499A-20B9-4F3A-B6DB-CC08224A766B}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "2ConsolenEingbaeAusgabe", "2ConsolenEingbaeAusgabe\2ConsolenEingbaeAusgabe.csproj", "{C46D499A-20B9-4F3A-B6DB-CC08224A766B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "4BMI", "4BMI\4BMI.csproj", "{C5E471A0-AABD-4C7C-B98F-ED9AE99CA9A4}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -27,6 +29,10 @@ Global
{C46D499A-20B9-4F3A-B6DB-CC08224A766B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C46D499A-20B9-4F3A-B6DB-CC08224A766B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C46D499A-20B9-4F3A-B6DB-CC08224A766B}.Release|Any CPU.Build.0 = Release|Any CPU
{C5E471A0-AABD-4C7C-B98F-ED9AE99CA9A4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C5E471A0-AABD-4C7C-B98F-ED9AE99CA9A4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C5E471A0-AABD-4C7C-B98F-ED9AE99CA9A4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C5E471A0-AABD-4C7C-B98F-ED9AE99CA9A4}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down

0 comments on commit b46126f

Please sign in to comment.