C# solution search | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

C# solution search

Can’t understand why it want { in 12 line https://code.sololearn.com/czqDPmQUaX7o/?ref=app

14th Jan 2021, 8:12 PM
Oleg Ponomarev
4 Answers
+ 2
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SoloLearn { class Program { static void Main(string[] args) { public int gain = Console.ReadLine(); string[] games = { "Alien Shooter", "Tic Tac Toe", "Snake", "Puzzle", "Football", "Invalid number" }; arrayX p = new arrayX(); p.ArrayX = gain; arrayX(games[p.ArrayX]); } } class arrayX { public int pepperX; public arrayX() { Console.WriteLine(); } public class ArrayX { get { return pepperX } set { if ( value == 0; ) { pepperX = value;} else if ( value == 1; ) { pepperX = value;} else if ( value == 2; ) { pepperX = value;} else if ( value == 3; ) { pepperX = value;} else if ( value == 4; ) { pepperX = value;} else { value = 5; } } } } }
14th Jan 2021, 8:12 PM
Oleg Ponomarev
+ 2
help please
14th Jan 2021, 8:12 PM
Oleg Ponomarev
+ 1
like this
8th Mar 2021, 3:13 PM
Тимофей Орловский
0
My code: ... static void Main(string[] args) { public int gain = Console.ReadLine(); string[] games = { "Alien Shooter", "Tic Tac Toe", "Snake", "Puzzle", "Football", "Invalid number" }; arrayX p = new arrayX(); p.ArrayX = gain; arrayX(games[p.ArrayX]); } ... Your code: ... static void Main(string[] args) { public int gain = Console.ReadLine(); string[] games = { "Alien Shooter", "Tic Tac Toe", "Snake", "Puzzle", "Football", "Invalid number" }; arrayX p = new arrayX(); p.ArrayX = gain; arrayX(games[p.ArrayX]); } ...
8th Mar 2021, 3:11 PM
Тимофей Орловский