[Solved] How to make socket chat in C++?

yes it is possible. You could use a library like Boos.Asio which has an example of chat in its documentation : http://www.boost.org/doc/libs/1_39_0/doc/html/boost_asio/example/chat/posix_chat_client.cpp (client part) 0 solved How to make socket chat in C++?

[Solved] C++ vector data strucure, loop only half of elements

You need to compute begin and end of your loop, i.e. first and last_exclusive. #include <vector> #include <numeric> #include <iostream> int main(){ std::vector<int> vec(16); std::iota(vec.begin(), vec.end(), 0); size_t first = 3; size_t last_exclusive = 7; //loop using indices for(size_t i = first; i < last_exclusive; i++){ const auto& w = vec[i]; std::cout << w << … Read more

[Solved] Why instance variables are not initialized before constructor creation. What happens if they are initialized at the class loading itself [closed]

Why instance variables are not initialized before constructor creation. What happens if they are initialized at the class loading itself [closed] solved Why instance variables are not initialized before constructor creation. What happens if they are initialized at the class loading itself [closed]

[Solved] behavior of memset

NO, your function does not behave the same as memset. Your function sets a pointer to NULL and memset sets the values of the data to the value supplied. Different things altogether. 3 solved behavior of memset

[Solved] Using iterator to read input [closed]

The code compiles because it is valid code. It just doesn’t do anything meaningful. sin_start is not a function, it is a variable of type istream_iterator<int>, where istream_iterator is a template class defined in the <iterator> header file. It is being passed std::cin as a parameter to its constructor, so it knows which stream to … Read more

[Solved] warning C4018: ‘

length() probably returns size_t or unsigned long and you are comparing it with signed long. Change long lDelFront = 0, lDelBack = 0; to size_t lDelFront = 0; size_t lDelBack = 0; to avoid signed/unsigned comparison 1 solved warning C4018: ‘

[Solved] Using function members in functionals in c++ [closed]

First of all continue is an already occupied keyword, so, better rename your function. The continue statement shall occur only in an iteration-statement and causes control to pass to the loop-continuation portion of the smallest enclosing iteration-statement, that is, to the end of the loop. In our case, you trying to use a non-static member … Read more

[Solved] C++ Sha1 issue with using char *

char *string1 = strdup(data.c_str()); // do stuff with string1 free(string1); SHA1((unsigned char*)&string1, strlen(string1), (unsigned char*)&digest); There’s your error. You created string1 You used it You freed it You used it again Don’t free what you still need to use. In addition to that: SHA1((unsigned char*)&string1, strlen(string1), (unsigned char*)&digest); What you’re doing here is passing the … Read more

[Solved] How to add space between every characters using C

The shorter, more general answer is that you need to bump characters back, and insert a ‘ ‘ in between them. What have you done so far? Does it need to be in place? One (perhaps not optimal, but easy to follow solution) would be making a larger array, copying in alternating letters, something like … Read more

[Solved] What is the logic behind this recursive program to find factorial in c++? [closed]

it is exactly like you said: 5*factorial(4)=5*4*factorial(3)=5*4*3*factorial(2)=5*4*3*2*factorial(1) So if it reaches 1 then this will be replaced by 5*factorial(4)=5*4*factorial(3)=5*4*3*factorial(2)=5*4*3*2*1 so the result of the last step goes into the second last step…. where 2*1 will be calculated… After that the 3rd last step gets the value of 2*1 = 2 and multiplies 3 on in … Read more