I am trying to learn C# and I'm still a beginner. recently, I have discovered a website that allows you to practice and train, but I faced a problem while working on it. When I type this code in Visual Studio, it works, but it doesn't on the website and the site tells me that I have an error!
The website is: www.codewars.com
The code is:
public class DnaStrand
{
public static string MakeComplement(string dna)
{
int length = dna.Length;
string [] smash = new string[length];
for (int i = 0; i < length; i++)
{
smash[i] = n.Substring(i,1);
}
for (int k = 0; k < length; k++)
{
if (smash[k] == "A") { smash[k] = "T"; }
else if (smash[k] == "T") { smash[k] = "A"; }
else if (smash[k] == "G") { smash[k] = "C"; }
else if (smash[k] == "C") { smash[k] = "G"; }
}
for (int o = 0; o < length; o++)
{
Console.Write(smash[o]);
}
}
}
Edit
The error is:
/home/codewarrior/fixture.cs(1,17): error CS0234: The type or namespace name VisualStudio' does not exist in the namespace
Microsoft'. Are you missing an assembly reference?
Error: Command failed: mcs -out:/home/codewarrior/test.dll -lib:/home/codewarrior,/runner/frameworks/csharp/mono-4.5,/runner/frameworks/csharp/nunit/bin -langversion:Default -sdk:4.5 -warn:2 -target:library -r:nunit.core.dll,nunit.framework.dll,nunit.core.interfaces.dll,nunit.util,Newtonsoft.Json.dll -r:System.Numerics.dll -r:System.Drawing.dll -r:System.Data.dll -r:System.Data.SQLite.dll -r:System.Data.SQLite.Linq.dll -r:System.IO.dll -r:System.Linq.dll -r:System.Linq.Dynamic.dll -r:System.Linq.Expressions.dll -r:System.Messaging.dll -r:System.Threading.Tasks.dll -r:System.Xml.dll -r:Mono.Linq.Expressions.dll /home/codewarrior/code.cs /home/codewarrior/fixture.cs
/home/codewarrior/fixture.cs(1,17): error CS0234: The type or namespace name VisualStudio' does not exist in the namespace
Microsoft'. Are you missing an assembly reference?