[Solved] C++ generate random numbers for a given seed [closed]

According to the documentation (which you really should read!): Returns a pseudo-random integral value between ​0​ and RAND_MAX Where RAND_MAX is implementation defined, but is guaranteed to be at least 32767. In fact, it often is 32767, and that appears to apply to you. The documentation also states: rand() is not recommended for serious random-number … Read more

[Solved] while loop exit, without well-known way [closed]

Use goto: This will only exit the while loop. while (true) { … if (some condition) { goto CLEANUP; } … } CLEANUP: … exit() the program: while (true) { … if (some condition) { exit (EXIT_FAILURE); /* OR, if in the `main()` function: */ return EXIT_FAILURE; } …. } abort() the program: while (true) … Read more

[Solved] How to choose among two classes given a condition in c++? [closed]

Assuming you need to create object at compile time depending on a variable, you can try something like following class class1{}; class class2{}; int main( int argc, char *argv[] ) { constexpr bool variable =true; /* x is object of type class1 or class2 depending on compile time constant ‘variable’ */ typedef std::conditional<variable, class1, class2>::type … Read more

[Solved] My double function is not working correctly [closed]

You are missing the data types. The right code is: using System; namespace Application { class MainClass { public int times2 (int number) { return number * number; } public static void Main (string[] args) { times2(5); } } } 3 solved My double function is not working correctly [closed]

[Solved] Filling a ViewList from an xml file [closed]

Have you looked at How does one parse XML files?, http://msdn.microsoft.com/en-us/library/cc189056%28v=vs.95%29.aspx, http://social.msdn.microsoft.com/Forums/en-US/xmlandnetfx/thread/efcb9fe3-8d1a-47b0-a35e-8415ac1a93bd/ or http://www.codeproject.com/Articles/7718/Using-XML-in-C-in-the-simplest-way ? At least one of those should prove useful. 1 solved Filling a ViewList from an xml file [closed]

[Solved] If else the best option? [closed]

ok according to you comment and flowchart here is my suggestion to simplify it if (item.IsSet) { DialogResult isComplete = MessageBox.Show(“Complete set?”, “complete set?”, MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (isComplete == DialogResult.No) // Break out } if(item.IsNew) { DialogResult goodQuality = MessageBox.Show(“Is the quality good”, “quality”, MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (goodQuality == DialogResult.No) //not accepted (break) } //if … Read more

[Solved] How can I extract a string using C# Substring [closed]

Instead of splitting the useragent, you should use the properties already supplied the Asp.net Framework to detect the browser/os. Use this to get the browser name Request.Browser.Browser and browser version Request.Browser.MajorVersion to get the Os name Request.Browser.Platform and os version Request.UserAgent 1 solved How can I extract a string using C# Substring [closed]