+ 1

Hi! Скажите пожалуйста кто-нибудь в чем проблема в этом коде и как мне её решить?

https://code.sololearn.com/cIU3uK1IBO7X/?ref=app

25th Mar 2021, 4:50 AM
Iman🌸
Iman🌸 - avatar
2 Answers
+ 2
I don't know what you're trying to achieve, but you cannot access a string with indexing (square brackets) to assign a value to it... to get rid of error instead do: using System; class Program { static void Main(string[] args) { int p = 0; string s = "《》"; string m ="jkksnn s70 07yy99511"; string l = " "; string r = ""; for (int k = 0; k<m.Length; k++) { // if (m[k] == l[0]) m[k]+=s; if (m[k] == l[0]) r+=s; else r+=m[k]; } // Console.WriteLine(m); Console.WriteLine(r); } }
25th Mar 2021, 5:11 AM
visph
visph - avatar
+ 1
Thank you very much 👍🏻
25th Mar 2021, 5:20 AM
Iman🌸
Iman🌸 - avatar