[Solved] C# string compression

Ok i got it correct. Had to implement int helper = i; due to i being lost in 2nd for loop, in else statement. Answer: static string Compression(string test) { string result = string.Empty; for (int i = 0; i < test.Length; i++) { int helper = i; int counter = 1; for (int j … Read more

[Solved] Reversible Hash in C#

The most space efficient way to store binary data is to store it as bytes. The only way you may get it even shorter is via compression. But for 92 Characters that will not amount to much. As for Base64: There are cases where we are forced to transmit binary data over a medium not … Read more

[Solved] Need some help figuring out how to do 2 things in my C program [closed]

as far as i understand: #include <stdio.h> #include <string.h> void pause(void); void print_result(char **menu, int ret); void clrscr(void); #define MENU_INPUT(a) menu_input(a,sizeof(a)/sizeof(*a)) char * main_menu[]={ “Display First Menu”, “Display Sencond Menu” }; char * first_menu[]={ “Format Drive C:”, “Partition First Drive”, “Scan Drive” }; char * second_menu[]={ “Display an image”, “Play a sound” }; int menu_input(char … Read more

[Solved] Understanding Memory Layout of C Programs [closed]

What is ‘code’ memory and it is a part of which memory (RAM or Flash memory)? Is one of the sections of a program in an object file or in memory, which contains executable instructions. Code and read-only data are stored in flash memory. When are the local and global variables allocated in memory — … Read more

[Solved] I need some assistance with creating a certain shape / pattern [closed]

You should split your code into functions. Then your main function should look like this int main() { const auto rows = []() {std::size_t r; std::cin >> r; return r;}(); printHeader(rows); printDashes(rows); printMid(rows); printDashes(rows); printFooter(rows); return 0; } The first pyramid can be printed with void printStarsLine(const std::size_t row, const std::size_t rows) { const std::size_t … Read more

[Solved] How to submit a from in this page c++ [closed]

I’m not exactly sure what you’re planning to achieve, but here’s my guess: Your easiest solution is to use libcurl (available on various OSes): Documentation is here: https://curl.haxx.se/libcurl/c/ Or, if you prefer examples (I do) here’s a simple example to post some stuff on a remote server using http: https://curl.haxx.se/libcurl/c/http-post.html If you want to use … Read more

[Solved] WEMOS D1 + DallasTemperature: How to print temperature and temperature comparison in if [closed]

In this line: int insideThermometer = (int)insideThermometer; You create a local variable and assign it to itself. Not what you wanted. The global var you are trying to use is DeviceAddress insideThermometer = { 0x28, 0xFF, 0x83, 0x51, 0xB2, 0x17, 0x4, 0x8A }; If you look at the source code, DeviceAddress is typdef’d as typedef … Read more

[Solved] Need to search for number combinations within textbox(c#)

Try this: string Input = “919982115672”; Console.Write(Search(Input)); public string Search(string Input) { Dictionary<string, string> PreDefinedSearchAndTexts = new Dictionary<string, string>(); PreDefinedSearchAndTexts.Add(“8211”, “Hello”); PreDefinedSearchAndTexts.Add(“82”, “My name is inigo montya”); PreDefinedSearchAndTexts.Add(“9821”, “You killed my father”); PreDefinedSearchAndTexts.Add(“5672”, “Prepare to die”); StringBuilder sb = new StringBuilder(); foreach(string Key in PreDefinedSearchAndTexts.Keys) { if(Input.Contains(Key)) { sb.Append(Key).Append(” : “).AppendLine(PreDefinedSearchAndTexts[Key]); } } return sb.ToString(); … Read more