[Solved] How do I compare chars (or strings) using void functions, also comparing chars that were taken from a struct array

If I understand you correctly, you have a structure containing several members of different types and you are looking for a way how you could compare instances of this struct. It could look the following way: struct X { std::string s; char c; int i; bool operator==(const X& ref) { return s == ref.s && … Read more

[Solved] How to multiply two matrices having fractions as inputs in c [closed]

I wanted to use my own implementation of the Strassen optimization for matrix multiplication. It is highly optimized and hence has almost no pedagogical use but then I remembered that Wikipedia has actual C code in the Strassen-matrix-multiplication entry. The implementation there is not the best: it has no fallback to the naive algorithm if … Read more

[Solved] Trouble setting up the loops. (C++)

Array is a bad choice for your problem as it will take N*M comparisons(N in stdInput,M in fileInput). Better put in unordered map, then you can do for (int i: fileInput) if i not in stdInput print i 0 solved Trouble setting up the loops. (C++)

[Solved] Can’t use Count() in C#

Your resource is not a list but an object. Better implementation would be something like this. [HttpGet(“{id}”)] public IActionResult Get(string id) { using (var unitOfWork = new UnitOfWork(_db)) { var r = unitOfWork.Resources.Get(id); if (r == null) { return NotFound(); } return Ok(ConvertResourceModel(r)); } } 0 solved Can’t use Count() in C#

[Solved] how to return bool in void C# [closed]

if you want to ‘return ‘ a bool from a function there are several ways The obvious one is bool CheckQuote(string item, string line) { if (!line.Contains(item)) { return false } return true; } used like this if(!CheckQuote(“a”,”b”)) // error case if for some reason the method has to be void (why tho), you can … Read more

[Solved] Error while passing vector to instance of object in main

You are passing the wrong types to your constructor: “Jack” is of type const char[5] and the second argument 28.2 is of type double Your constructor though is expecting a std::vector<string> and a std::vector<double>. So the problem is your constructor is expecting a “list” of strings and doubles, what you are not giving him. Considering … Read more

[Solved] Replace filename in textbox [closed]

To get absolute path of that file use Path.GetDirectoryName(filePath) and combine it with new file name. You will get new file path If I understood it correctly, then in your case: text1.Text contains full file path. i.e.E:\Files\sample.pdf text2.Text contains new file name. i.e. newfilename.pdf On button_ClickEvent() you want new file name path. i.e. E:\Files\newfilename.pdf Implement … Read more

[Solved] Optimization setting

All command line arguments you supply are interpreted by the compiler (or compiler driver, in the case of some compilers like gcc). They may then be passed on to other programs that the compiler (or compiler driver) executes to complete particular tasks. Incidentally, -o is not an optimisation setting with quite a few compilers. It … Read more

[Solved] Count equal strings in a list of string and make them unique

This can be done with Linq and the GroupBy function pretty easily: var input = new string[] { “welcome guys”, “guys and”, “and ladies”, “ladies repeat”, “repeat welcome”, “welcome guys” }; var groups = input .GroupBy(x => x); foreach (var g in groups) { Console.WriteLine(“{0}, {1}”, g.Key, g.Count().ToString()); } welcome guys, 2 guys and, 1 … Read more

[Solved] Why am I not getting the remainder for “m”?

There are many ways to do this, this is the one closest to your own code: #include <stdio.h> int main() { int y, m; printf(“Input number of months: “); fflush(stdout); scanf(“%d”, &y); m = y % 12; y = y / 12; printf(” %i Year(s) \n %i Month(s)” , y, m); return 0; } The … Read more