diff --git a/.vs/VSWorkspaceState.json b/.vs/VSWorkspaceState.json new file mode 100644 index 0000000..6d09252 --- /dev/null +++ b/.vs/VSWorkspaceState.json @@ -0,0 +1,8 @@ +{ + "ExpandedNodes": [ + "", + "\\obj" + ], + "SelectedNode": "\\Program.cs", + "PreviewInSolutionExplorer": false +} \ No newline at end of file diff --git a/.vs/aed-lista1/v15/.suo b/.vs/aed-lista1/v15/.suo new file mode 100644 index 0000000..89f468a Binary files /dev/null and b/.vs/aed-lista1/v15/.suo differ diff --git a/.vs/slnx.sqlite b/.vs/slnx.sqlite new file mode 100644 index 0000000..d5ee405 Binary files /dev/null and b/.vs/slnx.sqlite differ diff --git a/Program.cs b/Program.cs index 7997afa..086f970 100644 --- a/Program.cs +++ b/Program.cs @@ -14,6 +14,7 @@ public static void Main(string[] args) Console.WriteLine("[2] - Queue"); Console.WriteLine("[3] - Stack"); Console.WriteLine("[4] - Erro"); + Console.WriteLine("[5] - Questão 5 com foreach"); Console.WriteLine("[0] - Sair"); Console.Write("=> "); opcao = int.Parse(Console.ReadLine()); @@ -31,7 +32,9 @@ public static void Main(string[] args) case 4: Questao4(); break; - + case 5: + Questao5Foreach(); + break; default: Console.Write("Cabo"); break; @@ -69,12 +72,12 @@ Calcule a soma e a média aritmética (use o comando FOR e depois o FOREACH).*/ Console.WriteLine("Soma = {0}", soma); Console.WriteLine("Média = {0}", soma/AL.Count); - Console.Write("Tecle qualquer coisa para voltar ao menu..."); + Console.WriteLine("Tecle qualquer coisa para voltar ao menu..."); Console.ReadKey(); Console.Clear(); } - public static void Questao2 () { + public static void Questao2 () { /*2 – Faça um programa que leia n números inteiros e os armazene em um Queue. Calcule a soma e a média aritmética (use o comando FOREACH para iterar sobre os elementos)*/ @@ -140,7 +143,7 @@ Calcule a soma e a média aritmética Console.Clear(); } - public static void Questao4() { + public static void Questao4() { /*4 – Faça um programa que preencha um ArrayList com elementos de diferentes tipos (int, double, float, boolean, String). Tente calcular a soma dos elementos. @@ -164,5 +167,38 @@ Que mensagem o Visual Studio retorna?*/ Console.ReadKey(); Console.Clear(); } + + public static void Questao5Foreach() { + /*5 – Faça um programa que preencha um ArrayList com os números entre 1 e 25. Pede-se: + • Imprima todos os elementos + • Imprima todos os elementos em ordem invertida + • Imprima todos os elementos em posições ímpares (o elemento da posição 1, 3, 5, ...) + • Imprima todos os elementos ímpares + • Imprima apenas os elementos da primeira metade do vetor (posição 0 a 12).*/ + + ArrayList numeros = new ArrayList(); + for(int i = 1; i<=25; i++) { + numeros.Add(i); + } + + //imprimindo todos os elementos + Console.WriteLine("Imprimindo todos os elementos"); + foreach(int num in numeros) + Console.Write($"{num}, "); + Console.WriteLine(); + + //imprimindo ordem invertida + numeros.Reverse(); + Console.WriteLine("Imprimindo todos os elementos em ordem invertida"); + foreach(int num in numeros) + Console.Write($"{num}, "); + Console.WriteLine(); + + //imprime em posições impares + + Console.WriteLine("Tecle qualquer coisa para voltar ao menu..."); + Console.ReadKey(); + Console.Clear(); + } } } \ No newline at end of file diff --git a/bin/Debug/netcoreapp3.1/Lista 1.dll b/bin/Debug/netcoreapp3.1/Lista 1.dll index eb38a9e..2f81223 100644 Binary files a/bin/Debug/netcoreapp3.1/Lista 1.dll and b/bin/Debug/netcoreapp3.1/Lista 1.dll differ diff --git a/bin/Debug/netcoreapp3.1/Lista 1.pdb b/bin/Debug/netcoreapp3.1/Lista 1.pdb index 1ad4588..b4ac473 100644 Binary files a/bin/Debug/netcoreapp3.1/Lista 1.pdb and b/bin/Debug/netcoreapp3.1/Lista 1.pdb differ diff --git a/bin/Debug/netcoreapp3.1/Lista 1.runtimeconfig.dev.json b/bin/Debug/netcoreapp3.1/Lista 1.runtimeconfig.dev.json index c1ad059..21c2879 100644 --- a/bin/Debug/netcoreapp3.1/Lista 1.runtimeconfig.dev.json +++ b/bin/Debug/netcoreapp3.1/Lista 1.runtimeconfig.dev.json @@ -1,8 +1,9 @@ { "runtimeOptions": { "additionalProbingPaths": [ - "C:\\Users\\Nayla Gomes\\.dotnet\\store\\|arch|\\|tfm|", - "C:\\Users\\Nayla Gomes\\.nuget\\packages" + "C:\\Users\\vinic\\.dotnet\\store\\|arch|\\|tfm|", + "C:\\Users\\vinic\\.nuget\\packages", + "C:\\Program Files\\dotnet\\sdk\\NuGetFallbackFolder" ] } } \ No newline at end of file diff --git a/obj/Debug/netcoreapp3.1/Lista 1.AssemblyInfo.cs b/obj/Debug/netcoreapp3.1/Lista 1.AssemblyInfo.cs index c894af5..bcbace6 100644 --- a/obj/Debug/netcoreapp3.1/Lista 1.AssemblyInfo.cs +++ b/obj/Debug/netcoreapp3.1/Lista 1.AssemblyInfo.cs @@ -1,9 +1,10 @@ //------------------------------------------------------------------------------ // -// This code was generated by a tool. +// O código foi gerado por uma ferramenta. +// Versão de Tempo de Execução:4.0.30319.42000 // -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. +// As alterações ao arquivo poderão causar comportamento incorreto e serão perdidas se +// o código for gerado novamente. // //------------------------------------------------------------------------------ diff --git a/obj/Debug/netcoreapp3.1/Lista 1.assets.cache b/obj/Debug/netcoreapp3.1/Lista 1.assets.cache index fddda81..82d01ea 100644 Binary files a/obj/Debug/netcoreapp3.1/Lista 1.assets.cache and b/obj/Debug/netcoreapp3.1/Lista 1.assets.cache differ diff --git a/obj/Debug/netcoreapp3.1/Lista 1.csproj.FileListAbsolute.txt b/obj/Debug/netcoreapp3.1/Lista 1.csproj.FileListAbsolute.txt index e9ac3ef..f224d35 100644 --- a/obj/Debug/netcoreapp3.1/Lista 1.csproj.FileListAbsolute.txt +++ b/obj/Debug/netcoreapp3.1/Lista 1.csproj.FileListAbsolute.txt @@ -11,3 +11,16 @@ C:\Users\Nayla Gomes\Desktop\Lista 1\obj\Debug\netcoreapp3.1\Lista 1.csproj.Core C:\Users\Nayla Gomes\Desktop\Lista 1\obj\Debug\netcoreapp3.1\Lista 1.dll C:\Users\Nayla Gomes\Desktop\Lista 1\obj\Debug\netcoreapp3.1\Lista 1.pdb C:\Users\Nayla Gomes\Desktop\Lista 1\obj\Debug\netcoreapp3.1\Lista 1.genruntimeconfig.cache +C:\Users\vinic\source\aed\aed-lista1\bin\Debug\netcoreapp3.1\Lista 1.exe +C:\Users\vinic\source\aed\aed-lista1\bin\Debug\netcoreapp3.1\Lista 1.deps.json +C:\Users\vinic\source\aed\aed-lista1\bin\Debug\netcoreapp3.1\Lista 1.runtimeconfig.json +C:\Users\vinic\source\aed\aed-lista1\bin\Debug\netcoreapp3.1\Lista 1.runtimeconfig.dev.json +C:\Users\vinic\source\aed\aed-lista1\bin\Debug\netcoreapp3.1\Lista 1.dll +C:\Users\vinic\source\aed\aed-lista1\bin\Debug\netcoreapp3.1\Lista 1.pdb +C:\Users\vinic\source\aed\aed-lista1\obj\Debug\netcoreapp3.1\Lista 1.csprojAssemblyReference.cache +C:\Users\vinic\source\aed\aed-lista1\obj\Debug\netcoreapp3.1\Lista 1.AssemblyInfoInputs.cache +C:\Users\vinic\source\aed\aed-lista1\obj\Debug\netcoreapp3.1\Lista 1.AssemblyInfo.cs +C:\Users\vinic\source\aed\aed-lista1\obj\Debug\netcoreapp3.1\Lista 1.csproj.CoreCompileInputs.cache +C:\Users\vinic\source\aed\aed-lista1\obj\Debug\netcoreapp3.1\Lista 1.dll +C:\Users\vinic\source\aed\aed-lista1\obj\Debug\netcoreapp3.1\Lista 1.pdb +C:\Users\vinic\source\aed\aed-lista1\obj\Debug\netcoreapp3.1\Lista 1.genruntimeconfig.cache diff --git a/obj/Debug/netcoreapp3.1/Lista 1.dll b/obj/Debug/netcoreapp3.1/Lista 1.dll index eb38a9e..2f81223 100644 Binary files a/obj/Debug/netcoreapp3.1/Lista 1.dll and b/obj/Debug/netcoreapp3.1/Lista 1.dll differ diff --git a/obj/Debug/netcoreapp3.1/Lista 1.pdb b/obj/Debug/netcoreapp3.1/Lista 1.pdb index 1ad4588..b4ac473 100644 Binary files a/obj/Debug/netcoreapp3.1/Lista 1.pdb and b/obj/Debug/netcoreapp3.1/Lista 1.pdb differ diff --git a/obj/Lista 1.csproj.nuget.dgspec.json b/obj/Lista 1.csproj.nuget.dgspec.json index 2a928e8..ae8e6e1 100644 --- a/obj/Lista 1.csproj.nuget.dgspec.json +++ b/obj/Lista 1.csproj.nuget.dgspec.json @@ -1,25 +1,30 @@ { "format": 1, "restore": { - "C:\\Users\\Nayla Gomes\\Desktop\\Lista 1\\Lista 1.csproj": {} + "C:\\Users\\vinic\\source\\aed\\aed-lista1\\Lista 1.csproj": {} }, "projects": { - "C:\\Users\\Nayla Gomes\\Desktop\\Lista 1\\Lista 1.csproj": { + "C:\\Users\\vinic\\source\\aed\\aed-lista1\\Lista 1.csproj": { "version": "1.0.0", "restore": { - "projectUniqueName": "C:\\Users\\Nayla Gomes\\Desktop\\Lista 1\\Lista 1.csproj", + "projectUniqueName": "C:\\Users\\vinic\\source\\aed\\aed-lista1\\Lista 1.csproj", "projectName": "Lista 1", - "projectPath": "C:\\Users\\Nayla Gomes\\Desktop\\Lista 1\\Lista 1.csproj", - "packagesPath": "C:\\Users\\Nayla Gomes\\.nuget\\packages\\", - "outputPath": "C:\\Users\\Nayla Gomes\\Desktop\\Lista 1\\obj\\", + "projectPath": "C:\\Users\\vinic\\source\\aed\\aed-lista1\\Lista 1.csproj", + "packagesPath": "C:\\Users\\vinic\\.nuget\\packages\\", + "outputPath": "C:\\Users\\vinic\\source\\aed\\aed-lista1\\obj\\", "projectStyle": "PackageReference", + "fallbackFolders": [ + "C:\\Program Files\\dotnet\\sdk\\NuGetFallbackFolder" + ], "configFilePaths": [ - "C:\\Users\\Nayla Gomes\\AppData\\Roaming\\NuGet\\NuGet.Config" + "C:\\Users\\vinic\\AppData\\Roaming\\NuGet\\NuGet.Config", + "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config" ], "originalTargetFrameworks": [ "netcoreapp3.1" ], "sources": { + "C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {}, "https://api.nuget.org/v3/index.json": {} }, "frameworks": { diff --git a/obj/Lista 1.csproj.nuget.g.props b/obj/Lista 1.csproj.nuget.g.props index 273688b..af2b7c1 100644 --- a/obj/Lista 1.csproj.nuget.g.props +++ b/obj/Lista 1.csproj.nuget.g.props @@ -5,7 +5,7 @@ NuGet $(MSBuildThisFileDirectory)project.assets.json $(UserProfile)\.nuget\packages\ - C:\Users\Nayla Gomes\.nuget\packages\ + C:\Users\vinic\.nuget\packages\;C:\Program Files\dotnet\sdk\NuGetFallbackFolder PackageReference 5.7.0 diff --git a/obj/Release/netcoreapp3.1/Lista 1.AssemblyInfo.cs b/obj/Release/netcoreapp3.1/Lista 1.AssemblyInfo.cs new file mode 100644 index 0000000..89b6c12 --- /dev/null +++ b/obj/Release/netcoreapp3.1/Lista 1.AssemblyInfo.cs @@ -0,0 +1,23 @@ +//------------------------------------------------------------------------------ +// +// O código foi gerado por uma ferramenta. +// Versão de Tempo de Execução:4.0.30319.42000 +// +// As alterações ao arquivo poderão causar comportamento incorreto e serão perdidas se +// o código for gerado novamente. +// +//------------------------------------------------------------------------------ + +using System; +using System.Reflection; + +[assembly: System.Reflection.AssemblyCompanyAttribute("Lista 1")] +[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")] +[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")] +[assembly: System.Reflection.AssemblyProductAttribute("Lista 1")] +[assembly: System.Reflection.AssemblyTitleAttribute("Lista 1")] +[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] + +// Gerado pela classe WriteCodeFragment do MSBuild. + diff --git a/obj/Release/netcoreapp3.1/Lista 1.csproj.CoreCompileInputs.cache b/obj/Release/netcoreapp3.1/Lista 1.csproj.CoreCompileInputs.cache new file mode 100644 index 0000000..0ebc71e --- /dev/null +++ b/obj/Release/netcoreapp3.1/Lista 1.csproj.CoreCompileInputs.cache @@ -0,0 +1 @@ +77258ccb60256352fe8773c5098ed9bc34ea8358 diff --git a/obj/project.assets.json b/obj/project.assets.json index 1508531..bbee94c 100644 --- a/obj/project.assets.json +++ b/obj/project.assets.json @@ -8,24 +8,30 @@ ".NETCoreApp,Version=v3.1": [] }, "packageFolders": { - "C:\\Users\\Nayla Gomes\\.nuget\\packages\\": {} + "C:\\Users\\vinic\\.nuget\\packages\\": {}, + "C:\\Program Files\\dotnet\\sdk\\NuGetFallbackFolder": {} }, "project": { "version": "1.0.0", "restore": { - "projectUniqueName": "C:\\Users\\Nayla Gomes\\Desktop\\Lista 1\\Lista 1.csproj", + "projectUniqueName": "C:\\Users\\vinic\\source\\aed\\aed-lista1\\Lista 1.csproj", "projectName": "Lista 1", - "projectPath": "C:\\Users\\Nayla Gomes\\Desktop\\Lista 1\\Lista 1.csproj", - "packagesPath": "C:\\Users\\Nayla Gomes\\.nuget\\packages\\", - "outputPath": "C:\\Users\\Nayla Gomes\\Desktop\\Lista 1\\obj\\", + "projectPath": "C:\\Users\\vinic\\source\\aed\\aed-lista1\\Lista 1.csproj", + "packagesPath": "C:\\Users\\vinic\\.nuget\\packages\\", + "outputPath": "C:\\Users\\vinic\\source\\aed\\aed-lista1\\obj\\", "projectStyle": "PackageReference", + "fallbackFolders": [ + "C:\\Program Files\\dotnet\\sdk\\NuGetFallbackFolder" + ], "configFilePaths": [ - "C:\\Users\\Nayla Gomes\\AppData\\Roaming\\NuGet\\NuGet.Config" + "C:\\Users\\vinic\\AppData\\Roaming\\NuGet\\NuGet.Config", + "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config" ], "originalTargetFrameworks": [ "netcoreapp3.1" ], "sources": { + "C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {}, "https://api.nuget.org/v3/index.json": {} }, "frameworks": { diff --git a/obj/project.nuget.cache b/obj/project.nuget.cache index 6f2890b..5dc54f0 100644 --- a/obj/project.nuget.cache +++ b/obj/project.nuget.cache @@ -1,8 +1,8 @@ { "version": 2, - "dgSpecHash": "r1oy0cuo4g9nk+ecEx9PqfSQ+MvQCBujyqIwLHOJSp+tHGftRmJ5uIUWl8M/4sxdZPRbGEudOPuIEEcdk97pTw==", + "dgSpecHash": "l3Qc85HN52fa0TK12drR3ryIC3advRJw59Ypq0rOlaKIw6uSAlFPJ9jkDRG/MCgZonl/ngXcL5b6NVIFM7Cqpw==", "success": true, - "projectFilePath": "C:\\Users\\Nayla Gomes\\Desktop\\Lista 1\\Lista 1.csproj", + "projectFilePath": "C:\\Users\\vinic\\source\\aed\\aed-lista1\\Lista 1.csproj", "expectedPackageFiles": [], "logs": [] } \ No newline at end of file