[Solved] compile it by suing the root

There is a problem in this line: double v[k] = log(log(sqrt(e[k]+1)+1)+1); in the first iteration k == 0 so you are trying to declare a zero sized array. I dont understand the code enough to tell you how to fix it, but a zero sized array is definitely not what you want in that place. … Read more

[Solved] Structured Data: Nesting Triangles using structs and calculating

I think what you’re trying to do is this: float cal_area(triangle aTriangle) { float Area; Area = (aTriangle.vertices[1].x – aTriangle.vertices[0].x) * (aTriangle.vertices[2].y – aTriangle.vertices[1].y) – (aTriangle.vertices[1].y – aTriangle.vertices[0].y) * (aTriangle.vertices[2].x – aTriangle.vertices[1].x); if (Area < 0.0f) { return -Area / 2.0f; } else { return Area / 2.0f; } } solved Structured Data: Nesting Triangles … Read more

[Solved] List with numbers and text

There are many options, I describe some of them for you use Dictionary<int, string>Pros: very fast lookupCons: you can not have two string with same number, you don’t have a List var list2d = new Dictionary<int, string>(); list2d[1] = “hello”; list2d[2] = “world!”; foreach (var item in list2d) { Console.WriteLine(string.Format(“{0}: {1}”, item.Key, item.Value); } use … Read more

[Solved] Split calculator expression with binary and unary operations [closed]

I found easy solution. You could just write it instead of complain that there is no code in the question. string expression;//my calculator expression string[] operators;//array that contains both unary and binary operators. for(int i=0;i<operators.length;i++) { expression = expression.replace(operators[i],” “+operators[i]+ ” “); } string[] Values= expression.split(” “); solved Split calculator expression with binary and unary … Read more

[Solved] C++ cannot instantiate abstract class

getPosition is non-const in the interface class, but const in your derived class. These are two different functions and cause your problem. Adding the override keyword in the implementation class (if your compiler supports it) will flag this sort of problem. 0 solved C++ cannot instantiate abstract class

[Solved] C++ How can I delete -1 from my vector?

You’re accessing outside the vector. When you get to the last iteration of the for loop in bubbleSort(), numbers[i] is the last element of the vector, and numbers[i+1] is outside. This results in undefined behavior, and in your case it happens to access the -1 that you initially put in the vector and then popped … Read more

[Solved] Why doesn’t my C# compiler (Visual Studio) let me do this with a try block?

I’ll go over your points one by one: Declare long presult; right before the try statement. This makes the compiler mad because it wrongly thinks there’s a possibility of returning an unintialized variable. Actually, the compiler correctly determines that there is the possibility of returning an uninitialized variable. Since the variable is only set if … Read more

[Solved] How can I get the Name of the Program associated with a file extension using C#? [closed]

Use WinApi function AssocQueryString [DllImport(“Shlwapi.dll”, CharSet = CharSet.Unicode)] public static extern uint AssocQueryString(AssocF flags, AssocStr str, string pszAssoc, string pszExtra, [Out]StringBuilder pszOut, ref uint pcchOut); Create enumerations AssocF and AssocStr. public enum AssocStr { ASSOCSTR_COMMAND = 1, ASSOCSTR_EXECUTABLE, ASSOCSTR_FRIENDLYDOCNAME, ASSOCSTR_FRIENDLYAPPNAME, ASSOCSTR_NOOPEN, ASSOCSTR_SHELLNEWVALUE, ASSOCSTR_DDECOMMAND, ASSOCSTR_DDEIFEXEC, ASSOCSTR_DDEAPPLICATION, ASSOCSTR_DDETOPIC, ASSOCSTR_INFOTIP, ASSOCSTR_QUICKTIP, ASSOCSTR_TILEINFO, ASSOCSTR_CONTENTTYPE, ASSOCSTR_DEFAULTICON, ASSOCSTR_SHELLEXTENSION, ASSOCSTR_DROPTARGET, ASSOCSTR_DELEGATEEXECUTE, ASSOCSTR_SUPPORTED_URI_PROTOCOLS, … Read more

[Solved] Why is the integer `j` returning a `i`?

The * operator declares s as a pointer. This means that it will contain the address of the variable assigned. Here the value of the pointer s is i i.e, the first element of the string “iLoveC”. When you use post increment s[j++] it is equivalent to s[0]=’i’ but when you use s[++j] it is … Read more

[Solved] How can I print all the values in this linked list inside a hash table?

im quite confused what you are doing oO Is that what you are searching for? std::unorderd_map<std::string, std::list<std::string>> hash_map; // fill map …. // go to hash std::string hash = “whatever”; std::unorderd_map<std::string, std::list<std::string>>::iterator itr; itr = hash_map.find(hash); // check if value exists if(itr == hash_map.end()) std::cout << “not in map … ” << std::endl; else { … Read more