General C++ Programming - May 2020 (Page 9)

Can I shuffle values inside an array?
 
cards = {1,2,2,3,3,3,4,4,4,4,5,5,5,5,5,6,6,6,6,6,6,7,7,7,7,7,7,7,8,8,8,8,8,8,8,8,9,9,9,9,9,9,9,9,9,10,10,10,10,10,10,10,10,10,10}; How do I shuffle the value...
[5 replies] Last: const is for when you don't want something to be changed. The deck siz... (by dutch)
Multiple Arguments
 
Hi, I'm trying to make a project and I'm really confused. I have vectors to save values, and I want to pass arguments just to execute specific blocks of my code...
[1 reply] : Showing code would help more than an explanation. I'm assuming you mig... (by zapshe)
Newbie's asks on inheritance
 
How actually in real run time a derived class is implementing inheritance as class is just abstract class A { public : int a; }; class B : public A { int b...
[3 replies] Last: Did you understand? (by TheToaster)
by Vycues
C++ Overloading the divide operator
 
If a class name is DataContainer how should the function definition be to over load the divide operator / as shown in main ? The goal is to divide each array it...
[6 replies] Last: The code below works. Does it? What happens in this situation? ... (by doug4)
Performance stack allocation vs arithmetic operations?
 
I have somewhat beginners question, hopefully some of you guys can give a meaningful answer: Consider following 2 samples where both do the same thing: int e...
[2 replies] Last: Hi Repeater, thank you for perfect answer! Even though I said not to ... (by malibor)
Ragdoll physics
 
I googled 'game physics' specifically rag dolls and skeletal animation, but I was surprised that I didn't find any good tutorials on that, any recommendations? ...
[6 replies] Last: @Repeater well guess what you are too inferior, by the way I have alre... (by fewdiefie)
by Sam333
DirectX 11 SDK - Imgui Debug Error
 
So Im using Visual Studio 2019 and when i debug at x64 it gives no errors what so ever and the program runs fine. However, when i build the solution and try to ...
[7 replies] Last: basically what this line says "error X4502: invalid vs_2_0 output sema... (by fewdiefie)
Regex and Map
 
Why does this give me an error? std::map<std::regex, std::string> rgx{ std::make_pair(std::regex("[0-9]+.[0-9]+"), "FLOAT\n"), std::...
[5 replies] Last: Would an unordered map work then? Since it doesn't use < to sort on i... (by dutch)
Linker error to boost::mpi
 
Dear experts I confront the problem in linking error using boost::mpi which is included in my static library. The error is almost due to undefined reference...
[1 reply] : I am still tackling this problem. Seemingly, the static library is d... (by Mitsuru)
by avv123
Pseudocode
 
Hi all, I was wondering if anyone could help me with writing a pseudocode for my rock, paper, scissors c++ game.
[6 replies] Last: No, abdulbadii was not correct. I didn’t report him, though. Yo... (by Duthomhas)
How to return "unknown" when there are 2 attributes that have same occurances?
 
I would like to find out which label occurs most frequently. I first count the number of occurrences of each label. Then compare the occurrences and find out th...
[1 reply] : index 7 is sticky. Once you've found it once, there's no point carryi... (by salem c)
MPI technique/best practice documents
 
Dear experts Is there nice technical/best-practice books or documents for MPI for efficient parallelization. Nowadays, such a documents of shared memory p...
[2 replies] Last: Dear lastchance Thank you for your kind reply, and I would like to r... (by Mitsuru)
files and access mode
 
Coronavirus disease 2019 (COVID-19) is an infectious disease caused by severe acute respiratory syndrome coronavirus 2 (SARS-CoV-2). The disease was first ident...
[4 replies] Last: can u help me? You probably mean "Can you do it for me?" This is not... (by thmm)
Iterating through the contents of an array with a for loop
 
What am missing? I only get the message #include <iostream> #include <string> #include <array> using namespace std; int main (void) { int index = 0;...
[5 replies] Last: That makes sense, I had average evaluated after so then it worked. (by Programmingaddict)
by stav
Trying to create a serialization macro
 
Hi, I am trying to come up with a simple & generic way to serialize my structs. I would like something like a simple macro that i can just place in a struct an...
[1 reply] : Have you considered using a code generation tool like Google's protobu... (by helios)
I stuck on the quesion about Binary Tree. Can anybody help me please?
 
Suppose that a binary search tree stores, at each node, u, the height, u:height, of the subtree rooted at u, and the size, u:size of the subtree rooted at u. ...
[no replies]
What are these arguments in the main function call for?
 
There where some arguments in the main function. The code be like: #include<iostream.h> void main(int a,char *v ) {cout<<a<<*v; } output: 1C:\TUR...
[12 replies] Last: I had some small company projects in borland builder, but turbo as you... (by jonnin)
Selecting specific rows from .csv file and saving them to a new .csv file
 
Hi, New to c++ and the site. Please be gentle! I have a small project that I'm working on were I need to read a csv file. The file has 3 rows, this first colu...
[6 replies] Last: To begin with its just a simple copy of a few string but its also obje... (by jaybelfast)
Multiple operations on an array in a for loop
 
Can I do a for loop on an array and include multiple functions on it on the same line? I know I can do this: This will take the input from a user, assign ...
[2 replies] Last: In your second example, the RHS appears to be (a) constant and (b) lik... (by lastchance)
Writing in an area code from a number in a sequential file.
 
I am writing a code that reads from a sequential file. It recieves the name, state and phone number. I need to add in the area code based on the state linked ...
[2 replies] Last: Hey, jlb , the OP’s question isn’t perfectly-formed English, but ... (by Duthomhas)
May 2020 Pages: 1... 789
  Archived months: [apr2020] [jun2020]

This is an archived page. To post a new message, go to the current page.