Map
ɛ n h ᴀ n c ɛ ґ 🧟♂️
Anonymous
Anonymous
Choun
Help me solve this pls
___________________
Write a program to create 2 classes:
- Rectangle: has 2 functions: rectArea() and rectPerimeter() for calculate area and perimeter of rectangle .
• Triangle: has 2 functions: triArea() and triPerimeter() for calculate area and perimeter of triangle.
Anonymous
Thanks rose👍👍
Anupam2.7
Anonymous
Hey guys
How do I print prime number using c++ programming
Anupam2.7
İbn
Using pointers, locate the int main() function in RAM and print it ?
İbn
Anonymous
Is there a C++development program for writing game cheating programs?
We can cooperate and make a lot of money
BLESSED
Suraj
Any one know about any free workshop on c++
Marlo
Cout 12 numbers. From 1-12. Numbers which are division with 3 print start next to them. How can i do that? (C++)
Marlo
Print star next to them (*)
Holup
Holup
Do it yourselves 🙂
İbn
Unknown man
Can someone explain how to code of pascal triangle and how it works mean what the logic
Anonymous
Anyone that have new gpu? My budget is 100/130 eur in btc.If you have contact me! Only with escrow
Anonymous
what is reference on c++? i am struggling to find out what does it means
Pavel
what is reference on c++? i am struggling to find out what does it means
Reference is similar to a pointer, but
- reference can't be nullptr
- you can't reassign the address it points to, after it created
- dereferencing happens automatically (you don't need to do (*myVal) to get the value, or myVal->foo to refer to a member, use myVal and myVal.foo instead)
Anonymous
P
Hello to all friends, Please guide me how I can switch from C language to C++ and write a program in Qt
Bigissue
Hi is there someone programming in qt c++?
Jose
𝕷𝖔𝖗𝖊𝖓𝖟𝖔
Hi guys! I'd like an advice:
I have a server and many clients (at most, 100 clients) in my client-server application.
What the app does: it's like a Facebook showcase, where people can post messages (obv it's a much simpler version!).
So I want it to be as efficient as possible. Therefore, I came up with two solutions:
1) The server creates a main socket and sets it on listen. When a new connection is required, the server creates a client-reserved-socket, and a client-reserved-thread that will handle any action the client might take;
2) Without spawning a thread for each client, I create a client-reserved-socket, then wait for an action of the user. The code will use the select() function. Once a signal is perceived, the select() function will spawn a thread that will handle one task and one task only. So basically the thread is summoned whenever it's neede, does something and then it's killed by the machine.
I like the second one more, as I've never used it and I'd like to try something new, but given the fact that my system expects in the worst case scenario 100 people posting stuff on the showcase and possibly a user may take the same action multiple times, I'm quite worried about the expenditure the creation of every thread will have.
Yes, I know, a thread is quite easy to create and not so heavy to maintain, but consider this is done multiple times, possibly hundred of times!
What do you think? Let me know! Thanks if you read this!
Dima
Hi guys! I'd like an advice:
I have a server and many clients (at most, 100 clients) in my client-server application.
What the app does: it's like a Facebook showcase, where people can post messages (obv it's a much simpler version!).
So I want it to be as efficient as possible. Therefore, I came up with two solutions:
1) The server creates a main socket and sets it on listen. When a new connection is required, the server creates a client-reserved-socket, and a client-reserved-thread that will handle any action the client might take;
2) Without spawning a thread for each client, I create a client-reserved-socket, then wait for an action of the user. The code will use the select() function. Once a signal is perceived, the select() function will spawn a thread that will handle one task and one task only. So basically the thread is summoned whenever it's neede, does something and then it's killed by the machine.
I like the second one more, as I've never used it and I'd like to try something new, but given the fact that my system expects in the worst case scenario 100 people posting stuff on the showcase and possibly a user may take the same action multiple times, I'm quite worried about the expenditure the creation of every thread will have.
Yes, I know, a thread is quite easy to create and not so heavy to maintain, but consider this is done multiple times, possibly hundred of times!
What do you think? Let me know! Thanks if you read this!
I know that will sound abstract, but use fibers/coroutines for connections
and place all networking in it
Dima
kinda, pseudo code:
- Take X threads/cores to work on (I’ll take 8 )
- Create jobs (on fiber pool)
- Dedicate one or two (shouldnt be much) threads for Queue processing. Talking about incoming connections
- Dispatch connections to fibers (on another X threads)
𝕷𝖔𝖗𝖊𝖓𝖟𝖔
Aaaah ok, I get what you're saying
Dima
Dima
fibers on win32 api
Dima
my point is to take 1-2 threads (depends on your workload, probably one is enough) just to accept and dispatch connections
𝕷𝖔𝖗𝖊𝖓𝖟𝖔
Yea that could actually work, instead of leaving it to the main thread you say
Dima
just lock it, when accepting the incoming connections and process it queue-like
that’s a good scheme
Dima
this is how most of popular server(http,sockets) solutions would work
excluding distributed load
Dima
in distributed workload all of that what I said before gets more complicated
𝕷𝖔𝖗𝖊𝖓𝖟𝖔
Well in fact it seems like a fast and reasonable solution to the problem; the ones I mentioned all suffer from some issue
Anonymous
Peter
Hello, is there a way to printf a function pointer? 🤔
\Device\NUL
Peter
Using ℅p specifier ?
no dice,
it says " error: format ‘%p’ expects argument of type ‘void *’, but argument 2 has type ‘void (*)()’ [-Werror=format=] "
Pavel
Peter
\Device\NUL
emiteclap
Anonymous
#include<iostream>
using namespace std;
int *test() {
static int x[4];
for(int i=0; i<4; i++) {
x[i] = i%2;
}
return x;
}
int main()
{
int* arr = test();
printf("%d", *(arr+3));
return 0;
}
Anonymous
Anonymous
Руслан
if i understand your code correctly
Anonymous
But bro here we have used
Modulu operator %
Ольга
https://onlinegdb.com/uWJSUMywZ
Good day, I don't understand why the value is not stored in my value using the constructor. I would be grateful for an explanation
\Device\NUL
\Device\NUL
The correct convention from array to pointer is from type ptr[x],
to
*(ptr + sizeof(type) * x)
\Device\NUL
Ludovic 'Archivist'
Anton
Hi everyone. Does OCCF (orthodox canonical class form) imply that a class must not have other types of constructors?
Example:
class A {
public:
/* Standard OCCF */
A();
A(const A &);
~A();
A &operator=(const A &);
/* Does following constructors considered
to violate the canonical form? */
A(std::string);
A(std::string, int);
private:
std::string x;
int y;
};
Void
char a[14]={"Wrong!","January","February","March","April","May","June","July","August","September","October","November","December"};
Void
char a[14]={"Wrong!","January","February","March","April","May","June","July","August","September","October","November","December"};
Guys is there anything wrong with this
You know me
Void
Void
Anonymous
🤔why
Because an array of chars is a string
An array of strings is an array of arrays of chars
Void
Get