General C++ Programming - December 2021

by frek
Get updated and ready for important C++ exercises
 
Hello all, I'm an experienced C++ programmer with the absence about a year from it. Now I should re...
[1 reply] : I would recommend the exercises from B. Stroustrup's book. https://ww... (by thmm)
Math: how calculate the line dots?
 
the line have origin and destion points. how can i calculate the dots between the line origin and d...
[15 replies] Last: 3D Rotation: https://imgur.com/qOgUuPf 2D Rotation: https://imgur.com... (by Cambalinho)
fastest find and replace for a string (1,2,3)
 
This is how I'm doing it; is there a faster way? The program could do it millions of times, so I ex...
[59 replies] Last: Here is a search and replace (SAR) by simple string indexing. I use a... (by oggin)
Eigen is not fast??
 
(Edit - OP has vanished: or been assisted to depart) Well, dividing by 0 is quite fast ... if not ...
[3 replies] Last: I guess the OP has vanished, but Eigen is likely to benefit substantia... (by mbozzi)
by Cplusc
Sparse Matrix transpose
 
hello everyone. I have a matrix in which most of the elements are zero. For efficiency purpose, I st...
[16 replies] Last: ...and now the transpose is ridiculously easy. :O) (by Duthomhas)
How to avoid dynamic memory allocation, and templates for matricez using Eigen library in C++
 
Hello dear all Look i am using the library Eigen, for Matrix and vector calculations. when, i trie...
[8 replies] Last: Jonnin, i never got such an nice answer telling the truth, Thank you v... (by baezacaljo)
how to find the highest sum of a subsequence
 
How to write a program in C++ to find the highest sum of subsequence elements of a given sequence? A...
[5 replies] Last: #include <iostream> #include <vector> using namespace std; int bestS... (by lastchance)
by frek
Range based for loop
 
Doesn't mean for (const auto& x : v) { /* do something with the value of x */ } this for (auto x ...
[4 replies] Last: ^^^ that is a whole new discussion, but the & means that changes (if y... (by jonnin)
object not dynamically allocating
 
when i try to allocate new memory of an object of structure type, it gives a "read access violation"...
[8 replies] Last: I assume @seeplus is asking about line 7 of the first snippet of code ... (by mbozzi)
by Cplusc
Vector indexing
 
Hi everyone. Is there any way to give arbitrary indexing to a vector? For example I have a vector a=...
[10 replies] Last: A trivial method: #include <vector> #include<string> #include<iost... (by oggin)
Check input time format
 
Hello! I had a task - The program requests time in the format hh: mm: ss and checks the correctness ...
[3 replies] Last: This works with VS: #include <iostream> #include <string> #include ... (by seeplus)
by Cplusc
MPI_Allreduce for object of a class
 
Let's say I have a class named Node. A user defined vector of objects of this class is std::vector<N...
[3 replies] Last: Thanks for your answers. It was helpful. (by Cplusc)
by arnesc
tableprinter - Table-like output
 
I have written a small library with the help of iomanip and ostream header which allows a programmer...
[5 replies] Last: Thank you :) I refactored function object passing part and made value... (by arnesc)
Recursion Function
 
Hello, currently im working on a homework problem that deals with recursion, the problem goes as fol...
[10 replies] Last: Thanks! I believe Line 21 should have read return money + get_bars_1... (by mbozzi)
Help C++
 
First, I wish you all a good day. I'm trying to solve some problems in c ++ (I think it's importa...
[2 replies] Last: @The apprentice, PLEASE USE CODE TAGS (the <> formatting button to ... (by JRManx)
Generate a template class for a Matrix using vectors or change to Eigen library, C++
 
Hello dear all i am new using this forum. i have a question look, i have a project on which we ar...
[17 replies] Last: Thanks jonnin, I got it. Also, I searched for some info, and now I hav... (by baezacaljo)
by Cplusc
MPI
 
Let say I have a vector of vector in my master processor. I want to assign each vector to its corres...
[9 replies] Last: sorry, I didn't provide a good example of my question. (by Cplusc)
Pointer Arrays
 
This is the pseudocode for the project: Declare the following prototypes : int sumSales(int ...
[7 replies] Last: they may work. its hard to say. you throw away the returned values! ... (by jonnin)
by ryuuki
alternating values
 
hi can you help me. i want to have my value in 2nd column under x1, ek0 and ek2 will become the valu...
[6 replies] Last: Thank you very much! I am just a beginner to this and just modifying e... (by ryuuki)
How to get the type of a variable without the "typeinfo" header?
 
I don't want to link the C++ (not even C's libc) and I want to learn how (and if) I can get the type...
[17 replies] Last: Honestly, I don't see why it shouldn't be allowed to post on differen... (by jonnin)
December 2021 Pages: 123
  Archived months: [nov2021] [jan2022]

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