[Solved] Defined macro not recognized

WIN32 isn’t the correct macro. It’s actually _WIN32. Either way, that’s a macro defined by Visual Studio C++, but you’re using MinGW so the actual macro to check for is __MINGW32__ or (64). This still is the wrong way to do things, since MSDN requires: #define _USE_MATH_DEFINES // for C++ #include <cmath> In order to … Read more

[Solved] what is a read() in c language [closed]

There exists no function called read() in the C language. This function is a common non-standard extension used by some specific operative systems, such as Unix and MS DOS. They implemented it in compiler- and system-specific ways. Later on, the function became standardized with POSIX version of the function. It would seem that your code … Read more

[Solved] How do I reverse text in C#? [closed]

char[] chararray = this.toReverse.Text.ToCharArray(); Array.Reverse(chararray); string reverseTxt = “”; for (int i = 0; i <= chararray.Length – 1; i++) { reverseTxt += chararray.GetValue(i); } this.toReverse.Text = reverseTxt; Hope this helps 4 solved How do I reverse text in C#? [closed]

[Solved] Formatting double values for display

You can use N format specifier as; double salary = 12345.6789; Console.WriteLine(salary.ToString(“N2”)); Result will be; 12,345.68 This specifier uses your CurrentCulture‘s NumberGroupSeparator and NumberDecimalSeparator properties by default. If these properties are not , and . in your CurrentCulture, you can provide InvariantCulture to this .ToString() method as a second parameter like; double salary = 12345.6789; … Read more

[Solved] How to convert hex to decimal in c#.net? [duplicate]

Console.Write(“Enter HEX: “); string hexValues = Console.ReadLine(); string[] hexValuesSplit = hexValues.Split(new char[] { ‘ ‘ }, StringSplitOptions.RemoveEmptyEntries); Console.WriteLine(“HEX = DECIMAL”); foreach (String hex in hexValuesSplit) { // Convert the number expressed in base-16 to an integer. int value = Convert.ToInt32(hex, 16); Console.WriteLine(string.Format(“{0} = {1}”, hex, Convert.ToDecimal(value))); } Console.ReadKey(); P.S. : The original code does not … Read more

[Solved] Create a class that will hold a LINQ query?

I am trying to select a row [and in a comment…] I was trying to get the whole row which has several data types. Then you don’t need to Cast() or ToList(). If you want a single record, just fetch that single matching record: return database.Staff_Mod_TBLs .Single(staff => staff.Staff_No == staffNo); or, if you want … Read more

[Solved] Math-pow incorrect results

Your question is very unclear; in the future, you’ll probably get better results if you post a clear question with a code sample that actually compiles and demonstrates the problem you’re actually having. Don’t make people guess what the problem is. If what you want to do is display a double-precision floating point number without … Read more