[Solved] Converting an iterative algorithm to a recursive one [closed]

This is almost the same as BLUEPIXY‘s answer since I believe it’s the straight forward solution, but since you are confused by the function pointer, I removed that. #include <stdio.h> #include <stdlib.h> void printValue() { static unsigned int y; printf(“%d\n”, y); y += 1; } void recursiveFunction(int counter) { printValue(); if (–counter == 0) return; … Read more

[Solved] How to save uint64_t bytes to file on C?

EDIT. Since my compiler does not have uint64_t I have shown two ways to save a 64-bit value to file, by using unsigned long long. The first example writes it in (hex) text format, the second in binary. Note that unsigned long long may be more than 64 bits on some systems. #include <stdio.h> int … Read more

[Solved] I want to Split Datatable rows based on number [closed]

You could use following LINQ query: DataTable[] splittedtables = tbl.AsEnumerable() .Select((row, index) => new { row, index }) .GroupBy(x => x.index / 12) // integer division, the fractional part is truncated .Select(g => g.Select(x => x.row).CopyToDataTable()) .ToArray(); The array contains 6 tables, 5 with 12 rows, the last one has the remaining row. Checked with … Read more

[Solved] is there a way randomly separate a string into different string array and get back same same string [closed]

Assuming that the request for a “random” allocation of letters to arrays is for a pseudo-random (or, perhaps, a superficially arbitrary) allocation that is therefore reversible, one technique to do this would be to essentially use a transposition cipher. The algorithm would then be something like: Run the transposition cipher on the input text. Split … Read more

[Solved] accuracy of sinl and cosl function in c++

Do not use the value pi = 22 / 7 if you want accuracy. Please use M_PI which is defined in math.h. In MSVC you also need #define _USE_MATH_DEFINES to make the following values available. #define M_E 2.71828182845904523536 // e #define M_LOG2E 1.44269504088896340736 // log2(e) #define M_LOG10E 0.434294481903251827651 // log10(e) #define M_LN2 0.693147180559945309417 // ln(2) … Read more

[Solved] Why is my C++ program not working? [closed]

I have corrected the code.It works now. You may check the changes. #include <iostream> #include <fstream> #include <string> using namespace std; int counter(int n) { int i = 0, j = 0; char x1 = n / 10 + ‘0’; char x2 = n % 10 + ‘0’; char a; char b; fstream fisier(“bac.txt”, fstream::in); … Read more

[Solved] Recv returning zero incorrectly [closed]

You have a precedence problem. The line should be of the form if ((this->ReturnValue = recv(..).)) == -1) At present you’re comparing the result of recv() with -1 and storing the Boolean result of that comparison into ReturnValue. So recv() isn’t returning zero at all. 1 solved Recv returning zero incorrectly [closed]

[Solved] Jquery tabs with mvc partial views [closed]

This doesn’t really have anything to do with actions, it’s just a matter of including the desired content in your view. It could be as simple as this: <div id=”tabs”> <ul> <li><a href=”#tabs-1″>first tab</a></li> <li><a href=”#tabs-2″>second tab</a></li> <li><a href=”#tabs-3″>third tab</a></li> </ul> <div id=”tabs-1″> first tab content </div> <div id=”tabs-2″> second tab content </div> <div id=”tabs-3″> … Read more

[Solved] binding an List of objects to a Listbox

The Error you are getting is probably: Items collection must be empty before using ItemsSource. There is probably no problem with binding…. your bigest problem is invalid xaml. I am not sure what you are trying to achieve, but I guess you want to have listbox with horizonatal Stackpanel as ItemsPanel. Then it should be … Read more

[Solved] C Style Strings Difference : C/C++ [duplicate]

“Consider All declared in main().” Then 1) Yes. 2) Yes. 3) Yes, and no (it’s stored neither on the stack nor in the heap in common implementations). “i.e. allocates 6 bytes” — you seem to have forgotten about the memory required for the pointer. Also, there’s an erroneous claim in the comments and in another … Read more

[Solved] encrypt file with SHA256 using C/C++

SHA 256 stands for Secure Hash Algorithm ! It will only produce the hash of a given file . You can’t retrieve the original file from a given hash otherwise hash functions are useless. If you want to do encryption/decryption AES would be a better solution. Everything you need is in OpenSSL. solved encrypt file … Read more