General C++ Programming - May 2022 (Page 3)

win counter and list every winner in each game
 
I'm creating a program that has four games. Each game will have two team. In each game, there would be 3 rounds. Should there be a tie, there would be round 4 w...
[9 replies] Last: As a first refactor, consider something like this which has extra roun... (by seeplus)
by Cplusc
mpirun (1,2)
 
I am trying to run a code with MPI. I already have Microsoft SDKs and other mpi compiler along MINGW64 installed. I am trying to run the code using mpiexec -np...
[23 replies] Last: Yes, it needs to be set when building the package. That's why I said w... (by Cplusc)
Calling an array in a if function
 
Sorry if this isn't enough information, I'm a beginner in c++ coding. So what I want to do is to set end points at which my motor should turn directions. int ...
[4 replies] Last: I feel like something is missing. If the loop does 601 iterations, "s... (by keskiverto)
by SSDEEZ
accessing binary heap in loop
 
Hi, I'm trying to print out a binary max heap, that is made up of classes that I've created above but nothing is printing out. I've tried playing with how I ...
[1 reply] : duplicate: http://www.cplusplus.com/forum/beginner/283477/ (by George P)
how can pointer a class?
 
heres my form class: /////////For EVENTS////////////// #if defined __GNUC__ #define EVENT [[gnu::weak]] #elif defined __clang__ #define EVENT [[llvm::w...
[8 replies] Last: after several time and work and tests, i get it to work a simple test:... (by Cambalinho)
Resource leak
 
Hello, I just create a helper library to prevent resource leak and posted at https://github.com/TarcioV/ResourceGuard check out and tell me what you think.
[2 replies] Last: To avoid resource leak when porting legacy code most time we have to ... (by helios)
by Cplusc
clapack package example (1,2)
 
I download the CLAPACK example from here https://icl.cs.utk.edu/lapack-for-windows/clapack/CLAPACK-EXAMPLE.zip and also download the prebuilt libraries in relea...
[24 replies] Last: I got it worked. I again downloaded the clapack using curl -O https://... (by Cplusc)
what is b3b2 mean in C++ ?
 
I am new in learning C++ , pls I need to understand what is mean b3b2 , I think it is mean a value in Hex it is here in this code // Configure LEDSIG1 ...
[4 replies] Last: @kigar64551 thank you very much (by codernew)
Making a loop and table for outputs
 
Hello, I have a program here that can calculate the area of trapezoids from a given function F(x)=2ln(3x) . I have a loop here to ask for a different amount...
[6 replies] Last: If'n you have a compiler capable of using C++20 there is the <format> ... (by George P)
by frek
A method to do lookup in dictionary with a M x N board
 
Hi all, The exercise says: Given a dictionary, a method to do lookup in dictionary and a M x N board where every cell has one character. Find all possible wor...
[4 replies] Last: Passing the vectors by reference rather than value improves efficiency... (by lastchance)
a template-argument cannot be a type that contains 'auto' in C++20
 
In C++20 we are supposed to be able to use concepts like this: //type requirement template<typename T> concept containerTypes = requires (T t) { type...
[6 replies] Last: C++20: template < std::ranges::forward_range RANGE > std::ranges::ran... (by JLBorges)
Possible to replace member function to a noop function?
 
I write c++ with c++11 and have a question as title. Ex. class Hi { public: Hi(){}; test() {cout << "test" << endl;}; } void noop(){ ; // noo...
[3 replies] Last: alternately: class Hi { public: Hi(){}; void test() {cout << ... (by jonnin)
Constructing plotting routine for a polynomial?
 
Given this 4th order polynomial, x^4 - 3x^3 -15x^2 +10x +30, use lab 17 to construct a plotting routine from x = -3.5 to x = +5.5. increment 0.1, by replacing t...
[8 replies] Last: And the fact that it is written as a power (exponent) ... doesn't mea... (by seeplus)
Derived classes
 
hello,I am trying to use the derived method from a pointer to the base class without making the Base class knowing any of Derived classes. (Tried to simplify th...
[3 replies] Last: Lets have two shapes. Are they identical? If they are both triangles a... (by keskiverto)
Struggling with C-string method again
 
Ok so I am using a class MyString, and I am having a hard time properly writing a readLine function that is supposed to read from a file and display it without ...
[13 replies] Last: The C++ standard library copied over the C library for the most part, ... (by George P)
my getter and setter function not working
 
Please learn to use code tags, they make reading and commenting on source code MUCH easier. How to use code tags: http://www.cplusplus.com/articles/jEywv...
[4 replies] Last: Do NOT remove the text you already had! Edit the post to ADD code tag... (by George P)
Automatic Differentiation Library?
 
Hey people, I'm trying to get a library that does Automatic Differentiation. I've not successfully done this because of a few different command line errors from...
[5 replies] Last: OK, so if you want a gradient based approach then you can get derivati... (by lastchance)
by Cplusc
Solving linear system of equations using AztecOO
 
After almost several days struggling with Trilinos eventually I built and Installed the library. Now I'm trying to run a simple test to get more into Trilinos b...
[7 replies] Last: Yeah, #include guards are the usual approach to avoid including th... (by kigar64551)
Bubble sorting trouble
 
I just need to fix one thing but I am unsure what I need to do I know where to issue lies but am unsure how to fix it I know I must change the data type in the ...
[3 replies] Last: As one file, consider: #include <iostream> #include <iomanip> #incl... (by seeplus)
Error: expected primary-expression before ‘)’ token
 
I'm getting this error when running this code #include<iostream> #include<string> #include<vector> #include<algorithm> using namespace std; struct s...
[6 replies] Last: You need to maintain a container of the entered data (eg a vector). Po... (by seeplus)
May 2022 Pages: 123
  Archived months: [apr2022] [jun2022]

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