Category : c++-cli

I have to calculate the longest prefix string in the program. I am using c++ for this and I don’t actually know extensively about vector and its functions. The code is: #include <iostream> #include <vector> #include <string.h> using namespace std; class Solution { public: void longestCommonPrefix(vector<string>& strs) { string ans; strs.size(); //no of rows strs.push_back("flower"); ..

Read more

#include "pch.h" #include <iostream> using namespace System; using namespace System; using namespace System::Net::Http; using namespace System::Threading::Tasks; int main(array<System::String ^> ^args) { HttpClient ^client = gcnew HttpClient(); Task<System::Net::Http::HttpResponseMessage^> ^c = client->GetAsync ("http://www.google.com"); //what to do next? return 0; } I found this https://paoloseverini.wordpress.com/2014/04/22/async-await-in-c/ but not understand. Source: Windows Que..

Read more

Ive got a form project in c++ and I need to be able to display a string in a console. Here is my code (which doesnt work). Are there any better ways? std::string neemac = GenMacAddr(); //Copy String^ str2 = gcnew String(neemac.c_str()); //Finish system("echo ———————————— && echo Generated Mac: " + str2 + " && ..

Read more

I made month calendar. How to make "date" variable from date from calendar and how to instert this date to mysql database? MySqlCommand^ zapytanie = gcnew MySqlCommand("INSTERT INTO lotnisko.loty (data) VALUES (‘" +data +"’) ", laczbaze); when I did that, it didn’t work: private: System::Void kalendarz_DateChanged(System::Object^ sender, System::Windows::Forms::DateRangeEventArgs^ e) { data = kalendarz->SelectionStart; } I ..

Read more

I searched on the internet but couldn’t find the solution please help I get this error when I try to compile my project Why does this happen? I will be glad if you help me 🙂 enter image description here And code is here #include "MyForm.h" #include <windows.h> #include <windowsx.h> #include <winuser.h> #include <tchar.h> using ..

Read more

I am new to C++ and i am referring to PPP using c++ book. I am getting confused with operator overloading. Previously we use to return the stream object back like below.(also i am still figuring this out why this is done.) std::istream& operator>>(std::istream& is, Date& dd) { //do something return is; } I guess ..

Read more

I’m working on a toy CLI project, with which a user can enter some predefined commands and have the output printed out on the terminal. The CLI part is implemented with editline. Currently, I’m trying to add a paging functionality to the program. With which the program will show just one page of the output ..

Read more