[Solved] Don’t understand what this lines do [closed]

This is just a condensed one-line if statement. if(a>b)win+=3; This can be rewritten as if (a>b) { win = win + 3; } The following line v.push_back(b-a) Calculates the difference of b – a then uses push_back to add it to the end of the vector v. 3 solved Don’t understand what this lines do … Read more

[Solved] How to return values from a void function?

Make the parameter length a reference. void getLength (double & length) and delete the return. After calling the function the passed parameter has the value assigned to it in the function. 2 solved How to return values from a void function?

[Solved] Assist me in translating Visual Basic regex to C#? [closed]

Does this work properly for you? System.Text.RegularExpressions.Regex r = new System.Text.RegularExpressions.Regex(“<input name=\”authenticity_token\” type=\”hidden\” value=\”.*\” />”); MatchCollection matches = r.Matches(theusercp); foreach (Match itemcode in matches) { autcode = UrlEncode((itemcode.Value.Split(‘\”‘).GetValue(5))); } Perhaps you’ll also have to write var autcode and/or Server.UrlEncode. 8 solved Assist me in translating Visual Basic regex to C#? [closed]

[Solved] Display a map of two vectors

There could be gundreds of way to do that. Here is one: template<class T> void dumpVector( const std::vector<T>& vect ) { for ( std::vector<T>::const_iterator iter = vect.begin(); iter != vect.end(); ++iter ) { std::cout << ” ” << *iter; } } for ( std::map<vector<double>,vector<int>>::const_iterator mapIter = path.begin(); mapIter != path.end(); ++mapIter ) { std::cout << … Read more

[Solved] GCC compiler errors with “No such file or directory”

please do the following. On terminal check the present directory by ‘pwd’ command and then check the directory in which your programme is there and see if they are same or not. And while writing gcc yourfile it’s case sensitive. Hope this helps 1 solved GCC compiler errors with “No such file or directory”

[Solved] Can anyone give a simple code for houghlines using C#? As I got the transform, I want to detect the lines in images

I recommend using an existing feature extraction library. Some popular ones are AForge.NET and OpenCV. Pulled off of AForge.NET example documentation: HoughLineTransformation lineTransform = new HoughLineTransformation( ); // apply Hough line transofrm lineTransform.ProcessImage( sourceImage ); Bitmap houghLineImage = lineTransform.ToBitmap( ); // get lines using relative intensity HoughLine[] lines = lineTransform.GetLinesByRelativeIntensity( 0.5 ); foreach ( HoughLine … Read more

[Solved] Why my strings are not going to be XOR?

Just another try on the code base of the question , #include<iostream> #include<string.h> using namespace std; int main() { string pass; string enc=”akdhigfohre”; string x = “”; string y = “”; cout<<“Enter new password: “; cin>>pass; cout<<“\n\nYour New Password is:” << pass<<endl; for(size_t i = 0; i < pass.size(); ++i){ x += pass.at(i)^enc.at(i%enc.size()); } cout<<“\n\nEncrypted … Read more

[Solved] Unit Testing with ForEach [closed]

There is probably a lot you could do, but the first thing to do would be to make it more readable. Perhaps something like this: var nullActivities = from p in partnerList from t in p.Tenants let activity = agent.GetShopActivity(t, startDate, endDate) where activity == null select activity; Assert.Empty(nullActivities); Moreover: you may want to think … Read more

[Solved] My program, works but keeps on returning 0

Without looking at the way values are computed, the main issue is that, in your output functions, you are doing integer arithmetic to compute a value that is smaller than 1. For example, in OutputQuizz, (Q1 + Q2 ) / 20 will usually be less than 1. To force the compiler to use floating point, … Read more

[Solved] How do I return a double? [closed]

Ok, you basically have it right, but you are not yet multiplying the argument value. So your function should be double functionXYZ (double data) { return data * 10; } The type before the function name determines its ‘return type’ (what type of variables can be expected to be returned by this function). In this … Read more

[Solved] Why doesn’t the code print out “prime” when i use ‘C =1;’ but when i dont give any values to ‘C ‘ initially it works perfectly fine? [closed]

Why doesn’t the code print out “prime” when i use ‘C =1;’ but when i dont give any values to ‘C ‘ initially it works perfectly fine? [closed] solved Why doesn’t the code print out “prime” when i use ‘C =1;’ but when i dont give any values to ‘C ‘ initially it works perfectly … Read more

[Solved] Regex Conditions C# [closed]

I’m not sure if there is a way to short-circuit the Regex engine that way. You can use the control verbs (*FAIL) to immediately fail a match or (*LIMIT_MATCH=x) to limit the number of matches you receive to a specific quantity, but I don’t believe there’s a way to dynamically tell the engine to just … Read more

[Solved] Why does the program give me a different result when I use if statement [duplicate]

In an if else-if statement you put multiple conditions to evaluate the result. The following is how the statements will work in your case: if(row==1||row==n||row==2*n-1) cout<<“*”; //if true then put * or if false then move down else if (col==1&&row<n||col==n&&row>n) cout<<“*”; // if the first is false and the 2nd one is true then put … Read more