diff --git a/Math app - c#academy.csproj b/Math app - c#academy.csproj new file mode 100644 index 00000000..909301c3 --- /dev/null +++ b/Math app - c#academy.csproj @@ -0,0 +1,11 @@ + + + + Exe + net9.0 + Math_app___c_academy + enable + enable + + + diff --git a/Program.cs b/Program.cs new file mode 100644 index 00000000..9e6c07a9 --- /dev/null +++ b/Program.cs @@ -0,0 +1,140 @@ + +bool jogar = false; +int modo = 0; + +Console.WriteLine("----------------"); +Console.WriteLine("-- Math Quiz --"); +Console.WriteLine("Select an option:"); +Console.WriteLine("1) Add"); +Console.WriteLine("2) Subtract"); +Console.WriteLine("3) Multiply"); +Console.WriteLine("4) Divide"); +Console.WriteLine("----------------"); + +while (!jogar) +{ + modo = Convert.ToInt32(Console.ReadLine()); + + if (modo > 1 || modo < 5) + { + jogar = true; + } +} + +int vitorias = 0; +int[] pergunta; +int resposta; + +for (int i = 0; i < 6; i++) { + switch (modo) + { + case 1: + pergunta = Add(); + Console.WriteLine($"{pergunta[0]} + {pergunta[1]} = ?"); + resposta = Convert.ToInt32(Console.ReadLine()); + + if (resposta == pergunta[2]) + { + vitorias++; + Console.WriteLine("Correct!"); + } + else { Console.WriteLine("Wrong..."); } + + break; + case 2: + pergunta = Subtract(); + Console.WriteLine($"{pergunta[0]} - {pergunta[1]} = ?"); + resposta = Convert.ToInt32(Console.ReadLine()); + + if (resposta == pergunta[2]) + { + vitorias++; + Console.WriteLine("Correct!"); + } + else { Console.WriteLine("Wrong..."); } + + break; + case 3: + pergunta = Multiply(); + Console.WriteLine($"{pergunta[0]} * {pergunta[1]} = ?"); + resposta = Convert.ToInt32(Console.ReadLine()); + + if (resposta == pergunta[2]) + { + vitorias++; + Console.WriteLine("Correct!"); + } + else { Console.WriteLine("Wrong..."); } + + break; + case 4: + pergunta = Divide(); + Console.WriteLine($"{pergunta[0]} / {pergunta[1]} = ?"); + resposta = Convert.ToInt32(Console.ReadLine()); + + if (resposta == pergunta[2]) + { + vitorias++; + Console.WriteLine("Correct!"); + } + else { Console.WriteLine("Wrong..."); } + + break; + default: + Console.WriteLine("Not a valid input!"); + break; + } +} + +Console.WriteLine("------------------------"); +Console.WriteLine($"Your score: {vitorias}"); +Console.WriteLine("Thank you for playing!"); +Console.WriteLine("------------------------"); + +int[] Add() +{ + Random random = new Random(); + int n1 = random.Next(101); + int n2 = random.Next(101); + + return [n1, n2, n1 + n2]; +} + +int[] Subtract() +{ + Random random = new Random(); + int n1 = random.Next(101); + int n2 = random.Next(101); + + return [n1, n2, n1 - n2]; +} + +int[] Multiply() +{ + Random random = new Random(); + int n1 = random.Next(101); + int n2 = random.Next(101); + + return [n1,n2,n1 * n2]; +} + +int[] Divide() +{ + Random random = new Random(); + + int n1 = 0; + int n2 = 0; + bool divisivel = false; + + while (!divisivel) + { + n1 = random.Next(101); + n2 = random.Next(1,101); + + if (n1 % n2 == 0) + { + divisivel = true; + } + } + return [n1, n2, n1 / n2]; +} \ No newline at end of file diff --git a/bin/Debug/net9.0/Math app - c#academy.deps.json b/bin/Debug/net9.0/Math app - c#academy.deps.json new file mode 100644 index 00000000..957df1f3 --- /dev/null +++ b/bin/Debug/net9.0/Math app - c#academy.deps.json @@ -0,0 +1,23 @@ +{ + "runtimeTarget": { + "name": ".NETCoreApp,Version=v9.0", + "signature": "" + }, + "compilationOptions": {}, + "targets": { + ".NETCoreApp,Version=v9.0": { + "Math app - c#academy/1.0.0": { + "runtime": { + "Math app - c#academy.dll": {} + } + } + } + }, + "libraries": { + "Math app - c#academy/1.0.0": { + "type": "project", + "serviceable": false, + "sha512": "" + } + } +} \ No newline at end of file diff --git a/bin/Debug/net9.0/Math app - c#academy.dll b/bin/Debug/net9.0/Math app - c#academy.dll new file mode 100644 index 00000000..608678dc Binary files /dev/null and b/bin/Debug/net9.0/Math app - c#academy.dll differ diff --git a/bin/Debug/net9.0/Math app - c#academy.exe b/bin/Debug/net9.0/Math app - c#academy.exe new file mode 100644 index 00000000..344b7740 Binary files /dev/null and b/bin/Debug/net9.0/Math app - c#academy.exe differ diff --git a/bin/Debug/net9.0/Math app - c#academy.pdb b/bin/Debug/net9.0/Math app - c#academy.pdb new file mode 100644 index 00000000..ef64793b Binary files /dev/null and b/bin/Debug/net9.0/Math app - c#academy.pdb differ diff --git a/bin/Debug/net9.0/Math app - c#academy.runtimeconfig.json b/bin/Debug/net9.0/Math app - c#academy.runtimeconfig.json new file mode 100644 index 00000000..0a47295c --- /dev/null +++ b/bin/Debug/net9.0/Math app - c#academy.runtimeconfig.json @@ -0,0 +1,12 @@ +{ + "runtimeOptions": { + "tfm": "net9.0", + "framework": { + "name": "Microsoft.NETCore.App", + "version": "9.0.0" + }, + "configProperties": { + "System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false + } + } +} \ No newline at end of file diff --git a/obj/Debug/net9.0/Math app - c#academy.AssemblyInfo.cs b/obj/Debug/net9.0/Math app - c#academy.AssemblyInfo.cs new file mode 100644 index 00000000..60ac0214 --- /dev/null +++ b/obj/Debug/net9.0/Math app - c#academy.AssemblyInfo.cs @@ -0,0 +1,23 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +using System; +using System.Reflection; + +[assembly: System.Reflection.AssemblyCompanyAttribute("Math app - c#academy")] +[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] +[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")] +[assembly: System.Reflection.AssemblyProductAttribute("Math app - c#academy")] +[assembly: System.Reflection.AssemblyTitleAttribute("Math app - c#academy")] +[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] + +// Generated by the MSBuild WriteCodeFragment class. + diff --git a/obj/Debug/net9.0/Math app - c#academy.AssemblyInfoInputs.cache b/obj/Debug/net9.0/Math app - c#academy.AssemblyInfoInputs.cache new file mode 100644 index 00000000..ced38ff5 --- /dev/null +++ b/obj/Debug/net9.0/Math app - c#academy.AssemblyInfoInputs.cache @@ -0,0 +1 @@ +59647ace5c3c04e04e631862b49839de26ef3ddbe77a45d06f59c13faccc2a1e diff --git a/obj/Debug/net9.0/Math app - c#academy.GeneratedMSBuildEditorConfig.editorconfig b/obj/Debug/net9.0/Math app - c#academy.GeneratedMSBuildEditorConfig.editorconfig new file mode 100644 index 00000000..ca7fb61e --- /dev/null +++ b/obj/Debug/net9.0/Math app - c#academy.GeneratedMSBuildEditorConfig.editorconfig @@ -0,0 +1,15 @@ +is_global = true +build_property.TargetFramework = net9.0 +build_property.TargetPlatformMinVersion = +build_property.UsingMicrosoftNETSdkWeb = +build_property.ProjectTypeGuids = +build_property.InvariantGlobalization = +build_property.PlatformNeutralAssembly = +build_property.EnforceExtendedAnalyzerRules = +build_property._SupportedPlatformList = Linux,macOS,Windows +build_property.RootNamespace = Math_app___c_academy +build_property.ProjectDir = C:\Users\majua\source\repos\Math app - c#academy\Math app - c#academy\ +build_property.EnableComHosting = +build_property.EnableGeneratedComInterfaceComImportInterop = +build_property.EffectiveAnalysisLevelStyle = 9.0 +build_property.EnableCodeStyleSeverity = diff --git a/obj/Debug/net9.0/Math app - c#academy.GlobalUsings.g.cs b/obj/Debug/net9.0/Math app - c#academy.GlobalUsings.g.cs new file mode 100644 index 00000000..ac22929d --- /dev/null +++ b/obj/Debug/net9.0/Math app - c#academy.GlobalUsings.g.cs @@ -0,0 +1,8 @@ +// +global using global::System; +global using global::System.Collections.Generic; +global using global::System.IO; +global using global::System.Linq; +global using global::System.Net.Http; +global using global::System.Threading; +global using global::System.Threading.Tasks; diff --git a/obj/Debug/net9.0/Math app - c#academy.assets.cache b/obj/Debug/net9.0/Math app - c#academy.assets.cache new file mode 100644 index 00000000..37c04534 Binary files /dev/null and b/obj/Debug/net9.0/Math app - c#academy.assets.cache differ diff --git a/obj/Debug/net9.0/Math app - c#academy.csproj.BuildWithSkipAnalyzers b/obj/Debug/net9.0/Math app - c#academy.csproj.BuildWithSkipAnalyzers new file mode 100644 index 00000000..e69de29b diff --git a/obj/Debug/net9.0/Math app - c#academy.csproj.CoreCompileInputs.cache b/obj/Debug/net9.0/Math app - c#academy.csproj.CoreCompileInputs.cache new file mode 100644 index 00000000..dc507547 --- /dev/null +++ b/obj/Debug/net9.0/Math app - c#academy.csproj.CoreCompileInputs.cache @@ -0,0 +1 @@ +69d0cf4b58bf272794d55a9694e40b88e57dc85c25bef8785c80514ef76485bd diff --git a/obj/Debug/net9.0/Math app - c#academy.csproj.FileListAbsolute.txt b/obj/Debug/net9.0/Math app - c#academy.csproj.FileListAbsolute.txt new file mode 100644 index 00000000..6751afcb --- /dev/null +++ b/obj/Debug/net9.0/Math app - c#academy.csproj.FileListAbsolute.txt @@ -0,0 +1,14 @@ +C:\Users\majua\source\repos\Math app - c#academy\Math app - c#academy\obj\Debug\net9.0\Math app - c#academy.GeneratedMSBuildEditorConfig.editorconfig +C:\Users\majua\source\repos\Math app - c#academy\Math app - c#academy\obj\Debug\net9.0\Math app - c#academy.AssemblyInfoInputs.cache +C:\Users\majua\source\repos\Math app - c#academy\Math app - c#academy\obj\Debug\net9.0\Math app - c#academy.AssemblyInfo.cs +C:\Users\majua\source\repos\Math app - c#academy\Math app - c#academy\obj\Debug\net9.0\Math app - c#academy.csproj.CoreCompileInputs.cache +C:\Users\majua\source\repos\Math app - c#academy\Math app - c#academy\bin\Debug\net9.0\Math app - c#academy.exe +C:\Users\majua\source\repos\Math app - c#academy\Math app - c#academy\bin\Debug\net9.0\Math app - c#academy.deps.json +C:\Users\majua\source\repos\Math app - c#academy\Math app - c#academy\bin\Debug\net9.0\Math app - c#academy.runtimeconfig.json +C:\Users\majua\source\repos\Math app - c#academy\Math app - c#academy\bin\Debug\net9.0\Math app - c#academy.dll +C:\Users\majua\source\repos\Math app - c#academy\Math app - c#academy\bin\Debug\net9.0\Math app - c#academy.pdb +C:\Users\majua\source\repos\Math app - c#academy\Math app - c#academy\obj\Debug\net9.0\Math app - c#academy.dll +C:\Users\majua\source\repos\Math app - c#academy\Math app - c#academy\obj\Debug\net9.0\refint\Math app - c#academy.dll +C:\Users\majua\source\repos\Math app - c#academy\Math app - c#academy\obj\Debug\net9.0\Math app - c#academy.pdb +C:\Users\majua\source\repos\Math app - c#academy\Math app - c#academy\obj\Debug\net9.0\Math app - c#academy.genruntimeconfig.cache +C:\Users\majua\source\repos\Math app - c#academy\Math app - c#academy\obj\Debug\net9.0\ref\Math app - c#academy.dll diff --git a/obj/Debug/net9.0/Math app - c#academy.dll b/obj/Debug/net9.0/Math app - c#academy.dll new file mode 100644 index 00000000..608678dc Binary files /dev/null and b/obj/Debug/net9.0/Math app - c#academy.dll differ diff --git a/obj/Debug/net9.0/Math app - c#academy.genruntimeconfig.cache b/obj/Debug/net9.0/Math app - c#academy.genruntimeconfig.cache new file mode 100644 index 00000000..dcca99bf --- /dev/null +++ b/obj/Debug/net9.0/Math app - c#academy.genruntimeconfig.cache @@ -0,0 +1 @@ +c7c666b967a45ab161479f732dce7b1fb16d35f6268314a6c1eed31ca1c5f82c diff --git a/obj/Debug/net9.0/Math app - c#academy.pdb b/obj/Debug/net9.0/Math app - c#academy.pdb new file mode 100644 index 00000000..ef64793b Binary files /dev/null and b/obj/Debug/net9.0/Math app - c#academy.pdb differ diff --git a/obj/Debug/net9.0/apphost.exe b/obj/Debug/net9.0/apphost.exe new file mode 100644 index 00000000..344b7740 Binary files /dev/null and b/obj/Debug/net9.0/apphost.exe differ diff --git a/obj/Debug/net9.0/ref/Math app - c#academy.dll b/obj/Debug/net9.0/ref/Math app - c#academy.dll new file mode 100644 index 00000000..c0795a44 Binary files /dev/null and b/obj/Debug/net9.0/ref/Math app - c#academy.dll differ diff --git a/obj/Debug/net9.0/refint/Math app - c#academy.dll b/obj/Debug/net9.0/refint/Math app - c#academy.dll new file mode 100644 index 00000000..c0795a44 Binary files /dev/null and b/obj/Debug/net9.0/refint/Math app - c#academy.dll differ diff --git a/obj/Math app - c#academy.csproj.nuget.dgspec.json b/obj/Math app - c#academy.csproj.nuget.dgspec.json new file mode 100644 index 00000000..39700f25 --- /dev/null +++ b/obj/Math app - c#academy.csproj.nuget.dgspec.json @@ -0,0 +1,74 @@ +{ + "format": 1, + "restore": { + "C:\\Users\\majua\\source\\repos\\Math app - c#academy\\Math app - c#academy\\Math app - c#academy.csproj": {} + }, + "projects": { + "C:\\Users\\majua\\source\\repos\\Math app - c#academy\\Math app - c#academy\\Math app - c#academy.csproj": { + "version": "1.0.0", + "restore": { + "projectUniqueName": "C:\\Users\\majua\\source\\repos\\Math app - c#academy\\Math app - c#academy\\Math app - c#academy.csproj", + "projectName": "Math app - c#academy", + "projectPath": "C:\\Users\\majua\\source\\repos\\Math app - c#academy\\Math app - c#academy\\Math app - c#academy.csproj", + "packagesPath": "C:\\Users\\majua\\.nuget\\packages\\", + "outputPath": "C:\\Users\\majua\\source\\repos\\Math app - c#academy\\Math app - c#academy\\obj\\", + "projectStyle": "PackageReference", + "fallbackFolders": [ + "C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages" + ], + "configFilePaths": [ + "C:\\Users\\majua\\AppData\\Roaming\\NuGet\\NuGet.Config", + "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.FallbackLocation.config", + "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config" + ], + "originalTargetFrameworks": [ + "net9.0" + ], + "sources": { + "C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {}, + "C:\\Program Files\\dotnet\\library-packs": {}, + "https://api.nuget.org/v3/index.json": {} + }, + "frameworks": { + "net9.0": { + "targetAlias": "net9.0", + "projectReferences": {} + } + }, + "warningProperties": { + "warnAsError": [ + "NU1605" + ] + }, + "restoreAuditProperties": { + "enableAudit": "true", + "auditLevel": "low", + "auditMode": "direct" + }, + "SdkAnalysisLevel": "9.0.300" + }, + "frameworks": { + "net9.0": { + "targetAlias": "net9.0", + "imports": [ + "net461", + "net462", + "net47", + "net471", + "net472", + "net48", + "net481" + ], + "assetTargetFallback": true, + "warn": true, + "frameworkReferences": { + "Microsoft.NETCore.App": { + "privateAssets": "all" + } + }, + "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\9.0.310/PortableRuntimeIdentifierGraph.json" + } + } + } + } +} \ No newline at end of file diff --git a/obj/Math app - c#academy.csproj.nuget.g.props b/obj/Math app - c#academy.csproj.nuget.g.props new file mode 100644 index 00000000..8c4b3cff --- /dev/null +++ b/obj/Math app - c#academy.csproj.nuget.g.props @@ -0,0 +1,16 @@ + + + + True + NuGet + $(MSBuildThisFileDirectory)project.assets.json + $(UserProfile)\.nuget\packages\ + C:\Users\majua\.nuget\packages\;C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages + PackageReference + 6.14.2 + + + + + + \ No newline at end of file diff --git a/obj/Math app - c#academy.csproj.nuget.g.targets b/obj/Math app - c#academy.csproj.nuget.g.targets new file mode 100644 index 00000000..35a7576c --- /dev/null +++ b/obj/Math app - c#academy.csproj.nuget.g.targets @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/obj/project.assets.json b/obj/project.assets.json new file mode 100644 index 00000000..6edd6e34 --- /dev/null +++ b/obj/project.assets.json @@ -0,0 +1,80 @@ +{ + "version": 3, + "targets": { + "net9.0": {} + }, + "libraries": {}, + "projectFileDependencyGroups": { + "net9.0": [] + }, + "packageFolders": { + "C:\\Users\\majua\\.nuget\\packages\\": {}, + "C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages": {} + }, + "project": { + "version": "1.0.0", + "restore": { + "projectUniqueName": "C:\\Users\\majua\\source\\repos\\Math app - c#academy\\Math app - c#academy\\Math app - c#academy.csproj", + "projectName": "Math app - c#academy", + "projectPath": "C:\\Users\\majua\\source\\repos\\Math app - c#academy\\Math app - c#academy\\Math app - c#academy.csproj", + "packagesPath": "C:\\Users\\majua\\.nuget\\packages\\", + "outputPath": "C:\\Users\\majua\\source\\repos\\Math app - c#academy\\Math app - c#academy\\obj\\", + "projectStyle": "PackageReference", + "fallbackFolders": [ + "C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages" + ], + "configFilePaths": [ + "C:\\Users\\majua\\AppData\\Roaming\\NuGet\\NuGet.Config", + "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.FallbackLocation.config", + "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config" + ], + "originalTargetFrameworks": [ + "net9.0" + ], + "sources": { + "C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {}, + "C:\\Program Files\\dotnet\\library-packs": {}, + "https://api.nuget.org/v3/index.json": {} + }, + "frameworks": { + "net9.0": { + "targetAlias": "net9.0", + "projectReferences": {} + } + }, + "warningProperties": { + "warnAsError": [ + "NU1605" + ] + }, + "restoreAuditProperties": { + "enableAudit": "true", + "auditLevel": "low", + "auditMode": "direct" + }, + "SdkAnalysisLevel": "9.0.300" + }, + "frameworks": { + "net9.0": { + "targetAlias": "net9.0", + "imports": [ + "net461", + "net462", + "net47", + "net471", + "net472", + "net48", + "net481" + ], + "assetTargetFallback": true, + "warn": true, + "frameworkReferences": { + "Microsoft.NETCore.App": { + "privateAssets": "all" + } + }, + "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\9.0.310/PortableRuntimeIdentifierGraph.json" + } + } + } +} \ No newline at end of file diff --git a/obj/project.nuget.cache b/obj/project.nuget.cache new file mode 100644 index 00000000..147bcbcf --- /dev/null +++ b/obj/project.nuget.cache @@ -0,0 +1,8 @@ +{ + "version": 2, + "dgSpecHash": "mE+smj9obHM=", + "success": true, + "projectFilePath": "C:\\Users\\majua\\source\\repos\\Math app - c#academy\\Math app - c#academy\\Math app - c#academy.csproj", + "expectedPackageFiles": [], + "logs": [] +} \ No newline at end of file