Beginners - July 2022

by Ganado
Question about time complexity (1,2,3)
<edit: Somebody removed OP's post. Sad.> One of the people here, Duthomhas, has written about this in the past, so I'll link his post here: https://cplusplus.c...
[47 replies] Last: Big-O Complexity Chart: (by George PlusPlus)
by a456df
2d Array Help (1,2)
If I have a dynamic 2D array, and I want elements to change depending on a certain element's value in the array, how do I code that? For example: Say the ...
[26 replies] Last: @a456df, you want to get an idea of what is best practice by a few of ... (by George PlusPlus)
World Series
#include <iostream> #include <fstream> #include <vector> #include <string> using namespace std; void getInput(string array , ifstream&); void displayTeams(s...
[6 replies] Last: Ill give this a try thank you! (by bsauceda03)
I don't understand why this function is equal to 1 (1,2)
I'm new to C++ and I can't seem to understand why the following function is equal to 1: #include <iostream> int main(){ int x =7; std::cout <...
[22 replies] Last: this stuff really should not show up in production code. Its a 'confu... (by jonnin)
C++ implementation in java/android environment
Good day administrators Please what is ndk and how can one implement it within environment of ide/compiler? For example: i have ide/compiler in place, i c...
[1 reply] : From (by George PlusPlus)
Need Help with C++ Programming assignment
i'm currently a student struggling to understand C++ Programming and in dire need of assistance. I am making a Random Number Game, and have been given feedback...
[4 replies] Last: One possible first refactor as C++ could be as below. You don't say wh... (by seeplus)
Templates: Printing out the contents of any STL containers
I recently came across this code snippet which introduced an interesting template declaration: [code firstline=1] template<class T, template<class, class.....
[2 replies] Last: To finish the answer: your Foo constructor is not marked explicit ,... (by Duthomhas)
copying a member of a struct array to another member of another struct array
Hi, i am trying to copy a member of a struct within an array to a member of another array in a struct... I dont know where i am going wrong? I either want to c...
[6 replies] Last: You could create a vector in order to store all your dishes. Just an i... (by Geckoo)
Are null terminator automatically added by a compiler?
I have a c style string that I deliberately does not allot space for the null terminator? I then tried comparing it to a string where a nulll terminator is add...
[8 replies] Last: Thank you all for always being helpful! (by shaefayejem)
C++ Code Weather
I need help with function countDays(last part) portion it runs but not correctly #include <iostream> #include <iomanip> #include <fstream> #include <stri...
[6 replies] Last: Confirm that the given links are OK. (by seeplus)
Difference between pass by value and pass by reference
I'm having a hard time understanding the difference between pass by value and pass by reference. I know that by value means program make a copy of original inpu...
[6 replies] Last: There are reasons why passing by pointer or reference is preferred vs.... (by George PlusPlus)
Code stops working after adding if statements.
Hi. I have a bunch of checkboxes used to write different values to a file. The checkBox1 control does what it's supposed to. But when I add another checkBox45 t...
[6 replies] Last: That wasn’t the problem. I checked the code in a hex editor and foun... (by Cyclone)
I dont understand a textbook question
I am learning C++ with the help of a book called C++ Crash Course by Josh Lospinoso. Chapter 3 is about Reference Types and it talks about the relation between ...
[15 replies] Last: Do take careful notice about GCC C++20 support as mentioned on the GCC... (by George PlusPlus)
Question about vector looping
I have 2 programs, the first one: for(int i = 0; i < a.size(); i++) { a.push_back(a ); } The second one: int n = a.size(); for(int i = 0; i < n; i++...
[15 replies] Last: Thanks everyone ! (by IHaveSmallBrain)
What type of argument should I use in the function(s)?
Hello everyone, I am a bit beginner in cplusplus and I need to code a small piece of code but I do not know how to do it. I have two cost matrices like f_kt=[...
[4 replies] Last: Thank you so much , problem solved (by learner999)
what happens when deleting an object (1,2)
hi, I want to understand the results that I am getting. I did some research but did get an answer for this. The code shows the results I got. #include <...
[23 replies] Last: that's a bad QC before publishing. Not necessarily re the technical... (by seeplus)
by tonic
Converting data to byte
Hello guys, i want to send some data over tcp, can u do the conversion via static_cast<unsigned char> ? or can u give me an simple example so i can understan...
[10 replies] Last: Wow, i heard in programming there are thousand ways to solve a problem... (by tonic)
Need help in extracting field values for hexadecimal string (1,2)
Hello, As shown in below C++ program, I have a string with hexadecimal digits Right most two hex digits are extracted into hex_byte_str variable I need expre...
[35 replies] Last: Your following code line is not giving abnormal termination: Well, ... (by lastchance)
Declaring an array inside a function
Hello, I am making a program that takes in an unspecified amount of integers inside an array and adds up the absolute values of the numbers. Look at the code to...
[12 replies] Last: #include <iostream> #include <valarray> using namespace std; int get... (by lastchance)
I don't understand what does this piece of code mean? (1,2)
I don't understand what does this piece of code mean and how does it work? Thanks for your help ! struct Tree { unordered_map<char, Tree*> map; }; // Wh...
[39 replies] Last: @ NormalUser1234 It is a recursive function, so the identity of vari... (by Duthomhas)
July 2022 Pages: 123... 5
  Archived months: [jun2022] [aug2022]

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