[Solved] saving file to folder [closed]

[ad_1] It looks like you are using a variable called destination in this line webClient.DownloadFile(“http://i.imgur.com/” + picture, destination + picture); however you have not declared that variable and assigned it a value inside the buttonStart_Click method. You have a variable called destination declared in the buttonSaveTo_Click method, if this is the value you want to … Read more

[Solved] Why is my programming crashing [closed]

[ad_1] //loop through the 2d array for(int i = 0; i <= boardsize; i++) { getline(fin, line); for(int j = 0; j < boardsize; j++) { if(i != 0) board[i][j] = (int)line[j]; } line.clear(); } needs to be //loop through the 2d array for(int i = 0; i < boardsize; i++) // note < instead … Read more

[Solved] Method for parsing a txt file [closed]

[ad_1] File formats are specification of structure of a file. They’re usually in binary but in your case and in many other cases, they’re text. The first thing you need to do is decide on the structure of your document and then read it like by line. You can also use tools that make this … Read more

[Solved] Terminate called without an active exception : LeetCode Question 74 [closed]

[ad_1] }throw; A throw without following expression can be used inside an exception handler to re-throw the currently handled exception. However, at this point your program does not have an active exception. In this case, throw calls std::terminate(). This seems to be an edit artifact. [ad_2] solved Terminate called without an active exception : LeetCode … Read more

[Solved] How to use if commands with sentances [closed]

[ad_1] In this: if (Question == whats the weather?) Add quotes around the sentence. You want to write if (Question == “whats the weather?”) Also, since you’re using namespace std, you don’t need std:: before anything. 2 [ad_2] solved How to use if commands with sentances [closed]

[Solved] How to call functions from parent class in C++? [duplicate]

[ad_1] Calling functions from parent class directly is easy as the following: std::stringstream myobj; myobj << “Something…” myobj.std::iostream::flush(); Above example calls flush() directly from std::iostream (which is a typedef of std::basic_iostream<char> ). It is also possible to member functions from parent class of parent class: myobj.std::ostream::flush(); [ad_2] solved How to call functions from parent class … Read more

[Solved] Index was outside the bounds of the array in my case

[ad_1] I’m offering two solutions. The first formats the input as Pascal Case. static void Main(string[] args) { Console.WriteLine(ToCamelCase(“camels-drink-LOTS-OF_WATER”)); Console.ReadKey(); } public static string ToCamelCase(string str) { // This holds our output StringBuilder sb = new StringBuilder(); // Step 1 – split input into array of words string[] res = str.Split(new char[] { ‘-‘, ‘_’ … Read more

[Solved] Visual Studio said my variables are useless in a private method [closed]

[ad_1] Because these parameters are not being passed by reference, setting them to any value will only change the value of the parameter variables local to your helper method: it will not impact the values that were passed in to those parameters. Since you don’t use the new values you’re assigning to those parameters inside … Read more

[Solved] How do I get a specific string from a text file in C++

[ad_1] Well, what you just need is to iterate the lines of your file and see if the line contains the word you want. If it does, just print the line. Here is the core of what you need: while (getline (MyReadFile, myText)) { if(myText.find(yourString)!=std::string::npos){ cout<<myText<<\n; } } The if statement checks if it the … Read more