[Solved] { or ; expected error

[ad_1] It appears as though you have some illegal characters in the body of your expression for MyView: Change: public DCMViewer MyView { get **=>** myView; set => myView = value; } To: public DCMViewer MyView { get => myView; set => myView = value; I did a test on the syntax and received the … Read more

[Solved] Access index of current element in range-for loop c++20

[ad_1] After looking into defining a view interface, I decided to use range-v3. There are several things missing from std::ranges https://stackoverflow.com/a/68172842/11998382, and until they are added in future standards, it is sensible to use range-v3 rather than repeatedly attempting non-trivial implementations yourself. [ad_2] solved Access index of current element in range-for loop c++20

[Solved] “does not name a type” error c++ [duplicate]

[ad_1] You can avoid a circular include problem by using a forward declaration of a class instead of an #include: #ifndef ENTRANCE_H #define ENTRANCE_H #include <vector> #include “Diodio.h” class Segment; class Entrance { public: Entrance(); ~Entrance(); void operate(); protected: Segment *givesEntryTo; std::vector<Diodio> elBooths; std::vector<Diodio> manBooths; private: }; #endif // ENTRANCE_H (Entrance.cpp may or may not … Read more

[Solved] Strange behaviour with rand()

[ad_1] You realize, of course, that even a fair coin can give you ten heads in a row. There’s a probability that can be assigned to that combination. A fair coin will give half heads and half tails over many trials, but it’s not guaranteed to be 50/50 over a shorter run. Your own experience … Read more

[Solved] How can i Overload Method in c#? [closed]

[ad_1] To overload, you specify a method of the same type and name but with different parameters. for example: public int Foo(int bar) { return bar*2 } public int Foo(string bar) { return bar.Length*2; } Then when you reference the Foo method, you get 1 overload, the string parameter one. HOWEVER, The age part of … Read more

[Solved] parse a csv file in C#

[ad_1] I don’t think iterating through the items is a good idea if you just have split it before. I would change your code like that: string valuesString = File.ReadAllText(@”C:/Users/state.csv”); Console.WriteLine(valuesString); String[] values = valuesString.Split(‘,’); This way you will split this string only once. If you want to extend the buffer of the console, you … Read more

[Solved] C# – How do I put the Function Regex working? [closed]

[ad_1] this is not an issue with the bit of code you showed. This is a namespace issue at the very top of your file. The solution should be https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/namespaces/ using System; using System.Text.RegularExpressions; public class Test { public static void Main () { var isNumeric1 = IsNumeric(“1”); Console.WriteLine(isNumeric1); var isNumeric2 = IsNumeric(“HelloWorld”); Console.WriteLine(isNumeric2); //call … Read more

[Solved] Why does it return a random value other than the value I give to the function?

[ad_1] First of all, C functions are call-by-value: the int x arg in the function is a copy. Modifying it doesn’t modify the caller’s copy of whatever they passed, so your swap makes zero sense. Second, you’re using the return value of the function, but you don’t have a return statement. In C (unlike C++), … Read more

[Solved] Using if to compare strings c#

[ad_1] This code just doesn’t make sense. You’re entering AS but then checking if it can be converted to a long as part of your condition for equality. Just do this; public static void Main (string[] args) { string pass = “AS”; if (Console.ReadLine() == pass) Console.WriteLine(“hi”); } Then, if you want to put that … Read more