+ 4

Hi I need help NO NUMBER (Solution)

12th Dec 2020, 5:34 PM
ASHRAFOV RUSLAN
ASHRAFOV RUSLAN - avatar
5 Respuestas
+ 11
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SoloLearn { class Program { static List<string> numbers = new List<string>() { "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine" }; static void Main(string[] args) { string str = Console.ReadLine(); for (int i = 0; i < str.Length; i++) { for (int k = 0; k < numbers.Count; k++) { if (str[i] == Convert.ToChar(Convert.ToString(k))) { str = str.Replace(Convert.ToString(str[i]), numbers[k]); } } } str = str.Replace("onezero","ten"); Console.Write(str); } } }
12th Dec 2020, 5:47 PM
ÃKR
ÃKR - avatar
+ 12
Show your attempt first
12th Dec 2020, 5:39 PM
ÃKR
ÃKR - avatar
+ 3
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; namespace SoloLearn { class Program { static void Main(string[] args) { string[] words = Console.ReadLine().Split(); int[] f = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; string[] word = { "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten" }; foreach (string str in words) Console.Write(Regex.IsMatch(str, @"\d") ? word[Convert.ToInt32(str)] + " " : str + " "); } } } (C)
12th Dec 2020, 5:42 PM
ASHRAFOV RUSLAN
ASHRAFOV RUSLAN - avatar
+ 3
which is also not true
12th Dec 2020, 5:52 PM
ASHRAFOV RUSLAN
ASHRAFOV RUSLAN - avatar
+ 2
Ok
12th Dec 2020, 5:40 PM
ASHRAFOV RUSLAN
ASHRAFOV RUSLAN - avatar