Beginners - July 2022 (Page 4)

by Andy99
Counting loops in switch statement.
 
Hi, I need to count how many times A/B/C/D has been executed in this loop-switch statement. Here is my code: #include <iostream> #include <iomanip> #includ...
[13 replies] Last: Oh okay I overlooked it. Thanks (by Andy99)
Help with file processing into array
 
Hi, I have some questions regarding reading files and storing in arrays. 1) Am I correct to say that this line of code which is infile.getline(name ,100); ...
[3 replies] Last: Perhaps something like: #include <iostream> #include <fstream> int... (by seeplus)
pointer not assigning value to variable
 
Hello, the code bellow is self explanatory #include <iostream> #include <string> class Foo { public: Foo(std::string name) {name_ = name;}; std::st...
[4 replies] Last: Great, thank you all for the quick response. All clear now. (by rudiHammad)
Build issue with C++, Platformio, for Marlin
 
It's been 4 days now trying to build a firmware file for my new MKS Robin Nano 3.1 board. I've installed the hardware and with the default firmware, it seemed t...
[4 replies] Last: I'd suggest searching within files to find where values for BOARD_xxxx... (by seeplus)
Help me
 
I'm trying to make an C++ calculator but only adding numbers works! Here's what i tried: #include <iostream> using namespace std; int main() { i...
[10 replies] Last: [quote=AlanHudik]the links you sent in the post are also different tha... (by deleted account xyzzy)
how to create a text cursor in sfml
 
I want to create a text cursor, but i don't know how to properly, I've made a simple one, but it breaks when long characters like √ are in the sf::Text, how d...
[3 replies] Last: sf::Text::findCharacterPos gives you the position of a character. sf... (by Peter87)
Bmp file filter pixel adjusting / C language
 
Hello friends, I am currently working on a project which is filtering a bmp file. This smoothing filter uses a 3x3 blurring kernel which is a fixed size small ...
[8 replies] Last: Is it possible that the bitmap does not have a BITMAPINFOHEADER but in... (by coder777)
by jNc
how to assign all items in vector std::vector<std::vector<cv::Point> > test to 0?
 
how to assign all items in vector std::vector<std::vector<cv::Point> > test to 0?
[4 replies] Last: std::vector<std::vector<cv::Point>> test(100, {10, {0, 0}}); You wou... (by mbozzi)
Struggling to fill then print vector of structs
 
Howdy y'all, I am trying to take a .csv file, read it into a vector of struct. and then print out the vector. However I am unable to fill in the vector. When I ...
[7 replies] Last: I would first read each file line and split into a vector of string. T... (by seeplus)
Element-wise multiplication using Eiegn
 
I am trying to perform an element-wise multiplication of a row vector with matrix. In MATLAB this would be simply done by the "dot" operator or: data_deri...
[1 reply] : I was able to solve this issue with replacing the last line with: e... (by JamieAl)
Common Documentation Requirements/Standards
 
What are the common documentation standards for most companies that primarily use C++? I'd like to publish a library as open source.
[3 replies] Last: Cubbi, kigar64551, thank you both. I will go with doxygen. (by DOOMReboot)
Reading huffman tree from file
 
In the code below, in the decode function, I try rebuild the huffman tree generated in the encode function, and pass this tree to the getCode function and get t...
[4 replies] Last: Is it relevant where within the tree that character appears? Yes, i... (by klebermo)
by Geckoo
Prime numbers
 
Hello everyone. I hope that all is fine for you. Today I worked on a little code so as to compute prime numbers - a simple demonstration giving a vision about a...
[8 replies] Last: Yes - but as I said above, this is an in-efficient algorithm. For deal... (by seeplus)
Error when creating row vector using map in Eigen
 
I am trying to map my std:vector into an Eigen row vector so I can perform element-wise multiplication. I have the error: no matching function for call...
[2 replies] Last: Thanks! (by JamieAl)
How to return the address of a function's static variable?
 
There's no usage context for my question. Just a "what if" scenario I came up with. #include <iostream> using std::cout; struct A { static vo...
[3 replies] Last: Could also pass as int*& - ref to int* - which would avoid having to d... (by seeplus)
Basic File Handling - Everything correct?
 
Still learning and doing some basic file handling exercise and was wondering if I wrote this code correct and did I do all the error checking and if statements ...
[7 replies] Last: > My buffer array type is a wchar_t An overload of the file stream c... (by JLBorges)
by Geckoo
Boolean "in-line"
 
I don't know how I can call a boolean which has been concatenated in one single line. Usually I talk about "in-line" boolean, but it's not the right expression ...
[5 replies] Last: Thank you Peter87 and Keskiverto for your clever explanations. The t... (by Geckoo)
C++ while loops with strings
 
Regardless of what value I input the while statement won't recognize the input as matching either of the three predetermined values. I am very new to this... Wh...
[5 replies] Last: Thanks Seeplus for the link about DeMorgan laws. Interesting short rea... (by Geckoo)
Need to add multiple null values from a binary file to string
 
I want to encrypt a exe(executable file). I am reading the file as binary but when i Store the data in string it skips the null values and the end result after ...
[5 replies] Last: Reading a binary .exe file into a std::string like this works OK for m... (by seeplus)
segmetation fault
 
I need help. How can i fix that.I am getting a stackoverflow. I want to swap the names of my labels by pressing the swapLabels Button. QString A=ui->LabelRigh...
[3 replies] Last: How does on_swapLabels_clicked() know what label to swap? If you're... (by kbw)
July 2022 Pages: 12345
  Archived months: [jun2022] [aug2022]

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