Menù + opzione 1
This commit is contained in:
parent
f7c77cc677
commit
d29d204ee4
112
Program.cs
112
Program.cs
@ -1,9 +1,111 @@
|
|||||||
namespace strings_3;
|
namespace strings_3;
|
||||||
|
|
||||||
class Program
|
class Program {
|
||||||
{
|
static void Main(string[] args) {
|
||||||
static void Main(string[] args)
|
Menu();
|
||||||
{
|
}
|
||||||
Console.WriteLine("Hello, World!");
|
|
||||||
|
static void Menu() {
|
||||||
|
Console.Clear();
|
||||||
|
int scelta;
|
||||||
|
string stringa;
|
||||||
|
do {
|
||||||
|
Console.WriteLine("Inserire un'opzione:");
|
||||||
|
Console.WriteLine("1. Alterna i caratteri");
|
||||||
|
Console.WriteLine("2. Codifica di una frase");
|
||||||
|
Console.WriteLine("3. Primo carattere maiuscolo");
|
||||||
|
Console.WriteLine("4. Sostituisci sottostringa");
|
||||||
|
Console.WriteLine("5. Parola palindroma pari");
|
||||||
|
Console.WriteLine("5. Parola palindroma dispari");
|
||||||
|
Console.WriteLine("0. Esci");
|
||||||
|
Console.Write("Scelta: ");
|
||||||
|
scelta = Convert.ToInt32(Console.ReadLine());
|
||||||
|
|
||||||
|
switch (scelta) {
|
||||||
|
case 0:
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
Console.Clear();
|
||||||
|
AlternaCaratteri();
|
||||||
|
Pausa();
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
Console.Clear();
|
||||||
|
Console.Write("Inserire una frase: ");
|
||||||
|
//if (Palindromo(Console.ReadLine())) {
|
||||||
|
Console.WriteLine("La frase è palindroma");
|
||||||
|
//}
|
||||||
|
//else {
|
||||||
|
Console.WriteLine("La frase non è palindroma");
|
||||||
|
//}
|
||||||
|
Pausa();
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
Console.Clear();
|
||||||
|
//ContaStringa();
|
||||||
|
Pausa();
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
Console.Clear();
|
||||||
|
//Input4();
|
||||||
|
Pausa();
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
Console.Clear();
|
||||||
|
//PariEDispari();
|
||||||
|
Pausa();
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
Console.Clear();
|
||||||
|
//PariEDispari();
|
||||||
|
Pausa();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
Console.WriteLine("Opzione non valida.");
|
||||||
|
Pausa();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
while (scelta != 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void Pausa() {
|
||||||
|
Console.WriteLine("Premere un tasto per continuare. . .");
|
||||||
|
Console.ReadKey();
|
||||||
|
Console.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
static string Input() {
|
||||||
|
Console.Write("Inserire una frase: ");
|
||||||
|
return Console.ReadLine();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void AlternaCaratteri() {
|
||||||
|
string stringa1 = Input();
|
||||||
|
string stringa2 = Input();
|
||||||
|
bool stringa1Max = stringa1.Length > stringa2.Length;
|
||||||
|
int lunghezza = stringa1Max ? stringa1.Length : stringa2.Length;
|
||||||
|
|
||||||
|
for (int i = 0; i < lunghezza; i++) {
|
||||||
|
if (stringa1Max) {
|
||||||
|
if (i < stringa2.Length) {
|
||||||
|
Console.Write($"{stringa1[i]}{stringa2[i]}");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Console.Write(stringa1[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (i < stringa1.Length) {
|
||||||
|
Console.Write($"{stringa1[i]}{stringa2[i]}");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Console.Write(stringa2[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
Console.WriteLine();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
bin/Debug/net9.0/strings_3
Executable file
BIN
bin/Debug/net9.0/strings_3
Executable file
Binary file not shown.
23
bin/Debug/net9.0/strings_3.deps.json
Normal file
23
bin/Debug/net9.0/strings_3.deps.json
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
"runtimeTarget": {
|
||||||
|
"name": ".NETCoreApp,Version=v9.0",
|
||||||
|
"signature": ""
|
||||||
|
},
|
||||||
|
"compilationOptions": {},
|
||||||
|
"targets": {
|
||||||
|
".NETCoreApp,Version=v9.0": {
|
||||||
|
"strings_3/1.0.0": {
|
||||||
|
"runtime": {
|
||||||
|
"strings_3.dll": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"libraries": {
|
||||||
|
"strings_3/1.0.0": {
|
||||||
|
"type": "project",
|
||||||
|
"serviceable": false,
|
||||||
|
"sha512": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
bin/Debug/net9.0/strings_3.dll
Normal file
BIN
bin/Debug/net9.0/strings_3.dll
Normal file
Binary file not shown.
BIN
bin/Debug/net9.0/strings_3.pdb
Normal file
BIN
bin/Debug/net9.0/strings_3.pdb
Normal file
Binary file not shown.
12
bin/Debug/net9.0/strings_3.runtimeconfig.json
Normal file
12
bin/Debug/net9.0/strings_3.runtimeconfig.json
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"runtimeOptions": {
|
||||||
|
"tfm": "net9.0",
|
||||||
|
"framework": {
|
||||||
|
"name": "Microsoft.NETCore.App",
|
||||||
|
"version": "9.0.0"
|
||||||
|
},
|
||||||
|
"configProperties": {
|
||||||
|
"System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,4 @@
|
|||||||
|
// <autogenerated />
|
||||||
|
using System;
|
||||||
|
using System.Reflection;
|
||||||
|
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v9.0", FrameworkDisplayName = ".NET 9.0")]
|
||||||
BIN
obj/Debug/net9.0/apphost
Executable file
BIN
obj/Debug/net9.0/apphost
Executable file
Binary file not shown.
BIN
obj/Debug/net9.0/ref/strings_3.dll
Normal file
BIN
obj/Debug/net9.0/ref/strings_3.dll
Normal file
Binary file not shown.
BIN
obj/Debug/net9.0/refint/strings_3.dll
Normal file
BIN
obj/Debug/net9.0/refint/strings_3.dll
Normal file
Binary file not shown.
22
obj/Debug/net9.0/strings_3.AssemblyInfo.cs
Normal file
22
obj/Debug/net9.0/strings_3.AssemblyInfo.cs
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// This code was generated by a tool.
|
||||||
|
//
|
||||||
|
// 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("strings_3")]
|
||||||
|
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||||
|
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||||
|
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+f7c77cc677e2aad807832fec2775b0341e41ffd3")]
|
||||||
|
[assembly: System.Reflection.AssemblyProductAttribute("strings_3")]
|
||||||
|
[assembly: System.Reflection.AssemblyTitleAttribute("strings_3")]
|
||||||
|
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||||
|
|
||||||
|
// Generated by the MSBuild WriteCodeFragment class.
|
||||||
|
|
||||||
1
obj/Debug/net9.0/strings_3.AssemblyInfoInputs.cache
Normal file
1
obj/Debug/net9.0/strings_3.AssemblyInfoInputs.cache
Normal file
@ -0,0 +1 @@
|
|||||||
|
437b533b5127f5b1e5d132098240dac87416d889e2ff513387be247f3341bce6
|
||||||
@ -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 = strings_3
|
||||||
|
build_property.ProjectDir = /home/Verde/git/strings_3/
|
||||||
|
build_property.EnableComHosting =
|
||||||
|
build_property.EnableGeneratedComInterfaceComImportInterop =
|
||||||
|
build_property.EffectiveAnalysisLevelStyle = 9.0
|
||||||
|
build_property.EnableCodeStyleSeverity =
|
||||||
8
obj/Debug/net9.0/strings_3.GlobalUsings.g.cs
Normal file
8
obj/Debug/net9.0/strings_3.GlobalUsings.g.cs
Normal file
@ -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;
|
||||||
BIN
obj/Debug/net9.0/strings_3.assets.cache
Normal file
BIN
obj/Debug/net9.0/strings_3.assets.cache
Normal file
Binary file not shown.
@ -0,0 +1 @@
|
|||||||
|
ca558d4bb945142cb2adbb2c93dbfa921bf1ebdedfeac4feac1344d8c45f87cd
|
||||||
14
obj/Debug/net9.0/strings_3.csproj.FileListAbsolute.txt
Normal file
14
obj/Debug/net9.0/strings_3.csproj.FileListAbsolute.txt
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
/home/Verde/git/strings_3/bin/Debug/net9.0/strings_3
|
||||||
|
/home/Verde/git/strings_3/bin/Debug/net9.0/strings_3.deps.json
|
||||||
|
/home/Verde/git/strings_3/bin/Debug/net9.0/strings_3.runtimeconfig.json
|
||||||
|
/home/Verde/git/strings_3/bin/Debug/net9.0/strings_3.dll
|
||||||
|
/home/Verde/git/strings_3/bin/Debug/net9.0/strings_3.pdb
|
||||||
|
/home/Verde/git/strings_3/obj/Debug/net9.0/strings_3.GeneratedMSBuildEditorConfig.editorconfig
|
||||||
|
/home/Verde/git/strings_3/obj/Debug/net9.0/strings_3.AssemblyInfoInputs.cache
|
||||||
|
/home/Verde/git/strings_3/obj/Debug/net9.0/strings_3.AssemblyInfo.cs
|
||||||
|
/home/Verde/git/strings_3/obj/Debug/net9.0/strings_3.csproj.CoreCompileInputs.cache
|
||||||
|
/home/Verde/git/strings_3/obj/Debug/net9.0/strings_3.dll
|
||||||
|
/home/Verde/git/strings_3/obj/Debug/net9.0/refint/strings_3.dll
|
||||||
|
/home/Verde/git/strings_3/obj/Debug/net9.0/strings_3.pdb
|
||||||
|
/home/Verde/git/strings_3/obj/Debug/net9.0/strings_3.genruntimeconfig.cache
|
||||||
|
/home/Verde/git/strings_3/obj/Debug/net9.0/ref/strings_3.dll
|
||||||
BIN
obj/Debug/net9.0/strings_3.dll
Normal file
BIN
obj/Debug/net9.0/strings_3.dll
Normal file
Binary file not shown.
1
obj/Debug/net9.0/strings_3.genruntimeconfig.cache
Normal file
1
obj/Debug/net9.0/strings_3.genruntimeconfig.cache
Normal file
@ -0,0 +1 @@
|
|||||||
|
6f634f9766292935129b2b70666fd28412a3e6fc2f3d3e2e77507e62b3092d34
|
||||||
BIN
obj/Debug/net9.0/strings_3.pdb
Normal file
BIN
obj/Debug/net9.0/strings_3.pdb
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user