[Solved] Is it possible in c# to do math with file names that contain numbers? [closed]

[ad_1] This should be enough to get you started: var files = Directory.GetFiles(path); foreach (var f in files) { var info = new FileInfo(f); var name = info.Name.Split(‘.’)[0]; var extension = info.Name.Split(‘.’)[1]; int i; if (int.TryParse(name, out i)) { File.Move(info.FullName, string.Format(@”{0}\{1}.{2}”, path, i + 5, extension)); } } 2 [ad_2] solved Is it possible in … Read more

[Solved] Thread.Sleep without freezing UI for Framework 2.0

[ad_1] It seems I was getting this Not Responding on my program, because the other thread I had, that was running constantly, didn’t had any Sleep in it, and was running as fast as possible, thus making the program Not Responding and using up to 13% of the CPU… A simple Thread.Sleep(10); fixed everything [ad_2] … Read more

[Solved] infinite loop c++ with while and vector of pairs [closed]

[ad_1] One way to track down the problem without stepping through the debugger is to write values of the key data in important lines. Also, since you know that you have an infinite loop, add code to limit the number of times the loop gets executed. #include <iostream> #include <vector> #include <algorithm> using namespace std; … Read more

[Solved] What kind of information is stored in a .cpp file extension? [closed]

[ad_1] The .h usually has the class definition (code) #ifndef CLASS_T_H #define CLASS_T_H class class_t { public: class_t(); class_t(const class_t& o); ~class_t(); class_t& operator=(const class_t& o); private: }; #endif And the .cpp usually has the class implementation (code) #include “class_t.h” class_t::class_t() { } class_t::class_t(const class_t& o) { } class_t::~class_t() { } class_t& class_t::operator=(const class_t& o) … Read more

[Solved] C# basic Math, want to use decimals sometimes

[ad_1] Integers don’t have fractions. Use decimal if you want reliable numeric values with decimals. decimal box1 = decimal.Parse(Number1TextBox.Text); decimal box2 = decimal.Parse(Number2TextBox.Text); decimal box3 = decimal.Parse(Number3TextBox.Text); decimal answer = box1 * box2 * box3; You can round back the result like this: decimal rounded = Math.Round(answer); 5 [ad_2] solved C# basic Math, want to … Read more

[Solved] Search function returns the same regardless of item present in the binary search tree

[ad_1] Your code invoke UB. tree_node *root; … c=b.search(root,number); // root is uninitialized To solve this add a new function: class bst { … int search(tree_node * ,int); int search(int v) { return search(root, v); } }; Also in bst::search function: else //if (root != NULL){ Comment this condition if(root->data == data) { // r=”t”; … Read more

[Solved] Array has more values than expected

[ad_1] for(int i = 0; ; i++) When does your loop end?!?!? Your second condition in for (the testing expression) is evaluated as true (at least as long as i<4). You need for(int i = 0; i < 4 ; i++) Otherwise it may break anytime after i>=4, but not before, since all components of … Read more

[Solved] How to save ” in a string in C++?

[ad_1] You will need to escape the quotation mark you require in the string; std::string str(“Q850?51’18.23\””); // ^ escape the quote here The cppreference site has a list of these escape sequences. Alternatively you are use a raw string literal; std::string str = R”(Q850?51’18.23″)”; The second part of the problem is dependent on the format … Read more

[Solved] Go back to second foreach loop

[ad_1] You can use break. It breaks the loop you are in right now. Plus, in your condition you should use else if rather than multiple if. foreach (var pair in firstStrings) { foreach (var pair2 in secondStrings) { if (secondStrings.ContainsKey(pair.Key)) { LogMessage( pair.Value + ” <———-> ” + pair2.Value + ” On Line ” … Read more

[Solved] Advance Programming in c

[ad_1] *(num+1)[1] and **(num+2) are different ways of writing the same thing. That is, the third element of num. The type of num is short (*)[2]. That is, it is a pointer to an array of 2 short values. With these two facts in mind we can work out what the code is doing. Below … Read more

[Solved] Smtp authentification required [duplicate]

[ad_1] You need to tell the SMTP client that you will not be using your windows credentials to access the SMTP, so add smtpClient.UseDefaultCredentials = false; above this line of code smtpClient.Credentials = new NetworkCredential(“[email protected]”, “password”); Also, gmail doesn’t allow impersonation, so mailMessage.From = new MailAddress(“[email protected]”); will have no effect – the emails will still … Read more