Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Math app - c#academy.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>net9.0</TargetFramework>
<RootNamespace>Math_app___c_academy</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

</Project>
140 changes: 140 additions & 0 deletions Program.cs
Original file line number Diff line number Diff line change
@@ -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];
}
23 changes: 23 additions & 0 deletions bin/Debug/net9.0/Math app - c#academy.deps.json
Original file line number Diff line number Diff line change
@@ -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": ""
}
}
}
Binary file added bin/Debug/net9.0/Math app - c#academy.dll
Binary file not shown.
Binary file added bin/Debug/net9.0/Math app - c#academy.exe
Binary file not shown.
Binary file added bin/Debug/net9.0/Math app - c#academy.pdb
Binary file not shown.
12 changes: 12 additions & 0 deletions bin/Debug/net9.0/Math app - c#academy.runtimeconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"runtimeOptions": {
"tfm": "net9.0",
"framework": {
"name": "Microsoft.NETCore.App",
"version": "9.0.0"
},
"configProperties": {
"System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false
}
}
}
23 changes: 23 additions & 0 deletions obj/Debug/net9.0/Math app - c#academy.AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 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.
// </auto-generated>
//------------------------------------------------------------------------------

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.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
59647ace5c3c04e04e631862b49839de26ef3ddbe77a45d06f59c13faccc2a1e
Original file line number Diff line number Diff line change
@@ -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 =
8 changes: 8 additions & 0 deletions obj/Debug/net9.0/Math app - c#academy.GlobalUsings.g.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// <auto-generated/>
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;
Binary file added obj/Debug/net9.0/Math app - c#academy.assets.cache
Binary file not shown.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
69d0cf4b58bf272794d55a9694e40b88e57dc85c25bef8785c80514ef76485bd
14 changes: 14 additions & 0 deletions obj/Debug/net9.0/Math app - c#academy.csproj.FileListAbsolute.txt
Original file line number Diff line number Diff line change
@@ -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
Binary file added obj/Debug/net9.0/Math app - c#academy.dll
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
c7c666b967a45ab161479f732dce7b1fb16d35f6268314a6c1eed31ca1c5f82c
Binary file added obj/Debug/net9.0/Math app - c#academy.pdb
Binary file not shown.
Binary file added obj/Debug/net9.0/apphost.exe
Binary file not shown.
Binary file added obj/Debug/net9.0/ref/Math app - c#academy.dll
Binary file not shown.
Binary file added obj/Debug/net9.0/refint/Math app - c#academy.dll
Binary file not shown.
74 changes: 74 additions & 0 deletions obj/Math app - c#academy.csproj.nuget.dgspec.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
}
}
}
16 changes: 16 additions & 0 deletions obj/Math app - c#academy.csproj.nuget.g.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\majua\.nuget\packages\;C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages</NuGetPackageFolders>
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.14.2</NuGetToolVersion>
</PropertyGroup>
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<SourceRoot Include="C:\Users\majua\.nuget\packages\" />
<SourceRoot Include="C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages\" />
</ItemGroup>
</Project>
2 changes: 2 additions & 0 deletions obj/Math app - c#academy.csproj.nuget.g.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" />
Loading