Danya🔥
Danya🔥
Fixing some bugs
663 942 1605 15 6 12 3
Hello friends. I have learned C programming language. How can I learn C Plus Plus while maintaining previous knowledge of C?
klimi
Danya🔥
Chat Boss
🙃 🦋 sent a code, it has been re-uploaded as a file
🙃
Maverick
🙃
What's the problem?
Tommaso is organizing a foosball tournament, with a rich prize in candy. The table football of Volterra is very long, in fact teams with any number of players can play.
Participants in the tournament
N teams, numbered by0 to
N−1.The i-th team has
V [i] players. Tommaso wants to decide the prize pool so that whatever team wins is able to distribute the candies equally among its members, that is, giving each the same (whole) number of candies, without leaving any undistributed.
What is the minimum possible number of candies in the prize pool?
INPUT
The first line of the input file contains an integer
T, the number of test cases. Follow
T test cases, numbered from 1 to T. Each test case is preceded by a blank line.
Each test case consists of 2 lines:
the first line contains the integer N;
the second line contains the
N integers (V [i])
Mahdiy
klimi
Anonymous
#ot
rondon
C++ homework
klimi
sara🎀
Generating random numbers in computers has always been an intriguing topic for me. I have often pondered how computers can generate a truly random number and how they can ensure the randomness of that number.
However, the truth is that computers cannot generate truly random numbers as they are deterministic machines that follow a set of rules and algorithms. Nonetheless, they can generate pseudo-random numbers that appear to be random but are actually generated through a mathematical formula or algorithm.
One common method for generating pseudo-random numbers is the linear congruential generator (LCG) algorithm. This algorithm uses a starting value, called a seed, and a set of mathematical operations to generate a sequence of numbers that appear to be random. The seed value can be chosen randomly or based on a specific input, such as the current time or user input.
Another method for generating pseudo-random numbers is the Mersenne Twister algorithm, which is a more advanced and complex algorithm that generates a longer sequence of numbers with better statistical properties.
In summary, computers generate pseudo-random numbers through mathematical algorithms that use a starting value or seed to produce a sequence of numbers that appear to be random. While these numbers are not truly random, they are suitable for many applications that require a degree of randomness. Nonetheless, it is important to note that for applications that require a higher level of security, such as cryptography, cryptographically secure random number generators should be used.
Anonymous
Which directory is useful for graphics
Anonymous
Graphics in c++ directory
Anonymous
Natanim
Anonymous
Anonymous
Generating random numbers in computers has always been an intriguing topic for me. I have often pondered how computers can generate a truly random number and how they can ensure the randomness of that number.
However, the truth is that computers cannot generate truly random numbers as they are deterministic machines that follow a set of rules and algorithms. Nonetheless, they can generate pseudo-random numbers that appear to be random but are actually generated through a mathematical formula or algorithm.
One common method for generating pseudo-random numbers is the linear congruential generator (LCG) algorithm. This algorithm uses a starting value, called a seed, and a set of mathematical operations to generate a sequence of numbers that appear to be random. The seed value can be chosen randomly or based on a specific input, such as the current time or user input.
Another method for generating pseudo-random numbers is the Mersenne Twister algorithm, which is a more advanced and complex algorithm that generates a longer sequence of numbers with better statistical properties.
In summary, computers generate pseudo-random numbers through mathematical algorithms that use a starting value or seed to produce a sequence of numbers that appear to be random. While these numbers are not truly random, they are suitable for many applications that require a degree of randomness. Nonetheless, it is important to note that for applications that require a higher level of security, such as cryptography, cryptographically secure random number generators should be used.
How is this related to C++? Even otherwise it doesn't mention One time secure pad. So I won't rate this post high even if it were just a random post to highlight the shortcomings of PRNGs. It doesn't pay tribute to OTP. I am not warning you for this but please stick to C++ discussions in future.
Anonymous
It does. One Time Pad that I mentioned in my previous post is a pure/true random number generator
sara🎀
It's a better question :)
Anonymous
Read about one time pads. There are quite a few implementations of one time pads that are true random number generators but are slower when compared to prngs
Anonymous
Well yes it is. Read more about it. There are secure one time pads implementations that don't rely on any algorithm and generate pure random bits
Anonymous
Yes but it is impossible to crack them even if you know the pre shared key after the transfer has been completed. Of course knowing it before hand is insecure. That makes them TRNGs
Anonymous
Sharing of keys secretly is a well researched subject and there are already many implementations that allow key sharing safely. So the fact that OTP relies on safe key sharing is not an issue. The thing to notice is that it is impossible to crack OTP given a safe key
Anonymous
The keys can be generated truly randomly. All that is required is to generate bits 0 or 1 randomly and there are many implementations like Gregory Chaitin's ODP which generate keys that are truly independent of the input text.
If your question is then why can't they be used for TRNGs directly then, it is because they are limited by the resources they use. A key generator is usually a hardware based random generator which takes into account multiple factors like noise, accoustics, byte transfers across networks, fan performance and so on which are truly random and can't be controlled in its entirety by an external party
Anonymous
No. Read the latter half of my previous post
Anonymous
Well OTPs are considered TRNGs by the entire research community without any doubts raised. If you have a solid proof for why they can't be considered secure, you can write a paper on the same and peer reviews will determine if there is any truth in that
Anonymous
Nooooooo. I can truly generate a true randome number by saying out 1 or 0 continuously without thinking about it. What do you mean by humans can't do it? You can't generate the same sequence no matter how hard you try.
Computers instead rely on natural processes which are considered random like the ones I mentioned in my previous post. Even if a hacker were to take control of a system, he won't be able to control all the processes that a TRNG hardware generator relies on which is what makes them secure.
Anonymous
What do you mean by that?
10010100010
Anonymous
Read my previous post. I am generating a sequence of 1s and 0s that are truly random which will then be XORed with the input text. The key is the numbers that I generated. Knowing a part of the text that I generated, can you predict what the next sequence of 10 bits will be?
Anonymous
I don't know if you are playing dumb just for the sake of arguing or if you actually don't understand it. It is a well understood concept that human beings can generate a sequence of random numbers if they willingly desire it.
Computers on the other hand need assistance and they rely on the natural processes that I suggested earlier which for most parts have been accepted as being truly random by the research community
𝐃𝐄𝐌𝐎𝐍 𝐇𝐔𝐍𝐓𝐄𝐑™
Hello sir
𝐃𝐄𝐌𝐎𝐍 𝐇𝐔𝐍𝐓𝐄𝐑™
I am went to learn C/C++
Where can I start learn
Pavel
!notes
Pavel
Dima
Go through all the rules and the links mentioned in this post. Contravening the rules laid out here will result in a warning (least likely) or a ban (most likely).
This group is meant only for C/C++ discussion.
For chitchat of any other kind, go to the Offtopic chat, where anything unrelated to C/C++ programming can be discussed subject to the rules laid out for that group.
For information on learning C/C++, see our list of resources at @Resources
RULES:
1. Only English language is allowed. If you don't speak English, then this group is not for you. Please look elsewhere.
2. This group is meant to be used for C/C++ discussions alone. Assembly language discussions are allowed as well. The moderators' intention is to keep this group clean and to stick to the purpose the group was created for. Hence, questions or discussions about anything else is strictly forbidden. This further means that:
• You should not send useless messages like "Hi"/"Hello", "I'm new here" and similar.
• You should not send useless messages like "Does anyone know XYZ?", "Has anyone used XYZ?". Just ask your question directly.
• You should not ask questions without checking your problem in Google or any other search engine. Doing so will result in a warning. Following this, check the Resources section of this group to see if your question has an answer there.
• You should not ask exams/homework/interviews solutions. This will get you banned.
Asking for something that is there in the pinned message right after joining will get you banned.
3. NSFW content (porn, nudity etc) is not allowed.
4. Religion, politics and ideological topics are forbidden.
5. A little bit of programming related jokes and memes are allowed subject to admin group's discretion.
6. Advertisements of any kind are forbidden. Job postings will not be allowed either. If you are unsure about whether something could be construed as an advertisement, please check with one of the admins before posting the message. Not doing so will result in a ban.
7. Code sharing is encouraged subject to the following rules:
• Try to use markdown formatting.
• For many lines (10+) of code, use a pasting service like Gist, Pastebin, Ubuntu Paste, Hastebin. Don't post walls of code in the chat window. Firstly, it inconveniences others and secondly, you are unlikely to get a response and may even get warned or banned.
• Don't attach photos or videos of your screen. Screenshot captures are ok.
8. No illegal activity. This also means no piracy, no requesting/offering hacking/no posting of compiled executables. This will result in an immediate ban.
9. Respect people's privacy. Don't send private messages to people in this group without taking their permission to do so. Not following this rule will result in an immediate ban.
10. Avoid usernames that affects chat readability.
The group bot Rose offers a lot of readymade responses that can be used when replying to someone. The most commonly used ones are:
• #paste - Display a list of sites where code can be shared.
• #markdown - Learn how to use markdown formatting.
• #res - Post the link to the C/C++ resource collection.
• #meta - Tell someone to get to the point!
• #howtoask - Tell someone how they should ask a question.
• #ot - Tell someone that their question is off-topic and hence must be moved to the OT group.
Update: Matrix C/C++ room is also available now. It’s still “wip” but you may join already. It's available right at https://matrix.to/#/#cxx:neko-in.space
Go through all the rules and the links mentioned in this post. Contravening the rules laid out here will result in a warning (least likely) or a ban (most likely).
This group is meant only for C/C++ discussion.
For chitchat of any other kind, go to the Offtopic chat, where anything unrelated to C/C++ programming can be discussed subject to the rules laid out for that group.
For information on learning C/C++, see our list of resources at @Resources
RULES:
1. Only English language is allowed. If you don't speak English, then this group is not for you. Please look elsewhere.
2. This group is meant to be used for C/C++ discussions alone. Assembly language discussions are allowed as well. The moderators' intention is to keep this group clean and to stick to the purpose the group was created for. Hence, questions or discussions about anything else is strictly forbidden. This further means that:
• You should not send useless messages like "Hi"/"Hello", "I'm new here" and similar.
• You should not send useless messages like "Does anyone know XYZ?", "Has anyone used XYZ?". Just ask your question directly.
• You should not ask questions without checking your problem in Google or any other search engine. Doing so will result in a warning. Following this, check the Resources section of this group to see if your question has an answer there.
• You should not ask exams/homework/interviews solutions. This will get you banned.
Asking for something that is there in the pinned message right after joining will get you banned.
3. NSFW content (porn, nudity etc) is not allowed.
4. Religion, politics and ideological topics are forbidden.
5. A little bit of programming related jokes and memes are allowed subject to admin group's discretion.
6. Advertisements of any kind are forbidden. Job postings will not be allowed either. If you are unsure about whether something could be construed as an advertisement, please check with one of the admins before posting the message. Not doing so will result in a ban.
7. Code sharing is encouraged subject to the following rules:
• Try to use markdown formatting.
• For many lines (10+) of code, use a pasting service like Gist, Pastebin, Ubuntu Paste, Hastebin. Don't post walls of code in the chat window. Firstly, it inconveniences others and secondly, you are unlikely to get a response and may even get warned or banned.
• Don't attach photos or videos of your screen. Screenshot captures are ok.
8. No illegal activity. This also means no piracy, no requesting/offering hacking/no posting of compiled executables. This will result in an immediate ban.
9. Respect people's privacy. Don't send private messages to people in this group without taking their permission to do so. Not following this rule will result in an immediate ban.
10. Avoid usernames that affects chat readability.
The group bot Rose offers a lot of readymade responses that can be used when replying to someone. The most commonly used ones are:
• #paste - Display a list of sites where code can be shared.
• #markdown - Learn how to use markdown formatting.
• #res - Post the link to the C/C++ resource collection.
• #meta - Tell someone to get to the point!
• #howtoask - Tell someone how they should ask a question.
• #ot - Tell someone that their question is off-topic and hence must be moved to the OT group.
𝐃𝐄𝐌𝐎𝐍 𝐇𝐔𝐍𝐓𝐄𝐑™
Danya🔥
What an asshole lol
Dima
lol you are just angry
Anonymous
No they are not. It looks like it. And I could have generated a continuous sequence of 1s following that. What you have achieved is just fitting a curve to the random values I gave you which looks like a sine curve to you (actually cos)
Ludovic 'Archivist'
That is what std::random_device will do if your CPU supports it
Anonymous
Ludovic 'Archivist'
Anonymous
What an asshole lol
Lol. I had to check the logs to see why this guy pissed you off so much. Yeah I would have banned him as well.
Sanchit
Hi
Is there any way we can creat a text file at network path by c++ file handling
Sanchit
Like ofstream obj;
Obj.open(//172.23.45.343/foldername/filename.txt);
Does not create file
Віктор
i have a problem
"cannot open source file "mysql_driver.h"
cannot open source file "mysql_connection.h""
i tried 32-bit and 64-bit.
i add direction in "C/C++ -> General -> additional Include Directories".
i add direction in "Linker -> General -> additional Include Directories"
i wrote "mysqlcppconn8d.lib" in "Linker -> Input -> additional dependencies"
and I add mysql.driver.h, mysql.connection.h in "Headers files"
Віктор
I am writing the code in visual studio
Ziky
additional include direcotries sounds ok
Ziky
but linker needs to find only dll no sources
Віктор
Ludovic 'Archivist'
The trick is to always take the lower bit of every measure you take as those, for sensitive enough equipment, are literally so small they are affected by quantum phenomena that is governed by actual probabilities. There are equation, and they tell you the probability of things, not their value because most quantum phenomenon are not really deterministic.
For the lava lamps, the actual image is governed by so much thermodynamics that while it could be possible to simulate those fluids to guess a likeness of the images, they also use the lower bits of the pixel data that is again, so small of quantities of light that whatever guess you could have is just as likely to be good or wrong.
Another thing that is used is background radiation, again, taking the lower bits of the signal. These actually are equipped with detectors for tampering because malicious people could influence the measure with absurd amounts of radiowaves
Anonymous
You can fit a curve to the random numbers generated already but this curve cannot be extrapolated to random numbers generated thereon without changing the equation again and again. That is the whole point of randomness which is what I am trying to make you understand
Mr.Tech-Knight
Otoni
How can i remove a item from a vector in c++?
labyrinth
Is it possible to get the time a thread runs on CPU? This excludes IO op that may take time in a procedure but does not consume CPU resources.
Anonymous
Ziky
https://duckduckgo.com/?q=pthread+c+tutorial&kp=1&t=ffab&ia=web
Illya
Hi
Mr.Tech-Knight
Harsh
Give me some projects on the basis of c, c++
Anonymous
I compare elements of two containers which are defined as Cont1 and Cont2 in template function. I want to use std::less for comparison, how do I pass type of container element to it? Like I have vector<int> and list<uint32> and I want to compare by the the vector element type int?
Anonymous
Anonymous
Gabriel
Someone knows if the C++ 20 std is supported in Android?
klimi
klimi