Beginners - July 2020 (Page 7)

if/for/while do
 
pals, have to write a code which: Prints out for "n" nr. of times , the last result of the eq...
[13 replies] Last: Maybe the 4th requirement does not mean the sum of all the results, bu... (by Manga)
How to make a class "private"
 
As a minimal example, consider a library that provides a `Car`, and the `Car` has an `Engine` in it:...
[7 replies] Last: Thanks. I've edited my post. (by dhayden)
by sparki
Conversion to string from int
 
Hi, why is the output some garbage value at the start of the first 2 bits? and then fine for the res...
[1 reply] : That memset looks wrong. array is an int pointer, size 8 bytes (probab... (by Repeater)
by Xyz57
Code debugging assistance
 
I could use some help with debugging my code. I am not very good at debugging code so I could use so...
[4 replies] Last: BTW static const PI can best be put inside the class (it's not a data ... (by againtry)
by momof4
how to draw a number in the thousands
 
I have a function to draw numbers 0 through 999, but now I'm working on a project that is going to r...
[2 replies] Last: How about: void display_number(int num) { for (char digit: to_s... (by dutch)
Read file and input into vector
 
Hey everyone! I am pretty new to C++ (just started this month) and will appreciate if someone can he...
[5 replies] Last: Maybe something like this: #include <iostream> #include <fstream> #... (by dutch)
by momof4
move once per click
 
I'm making a very simple game, that involves something happening when a button is pushed. Trouble is...
[1 reply] : you need one of two things. first, check your tools to see if you hav... (by jonnin)
How can i change specific elements of an array?
 
Hello all! In the exercise that I'm working on it asks that I write an input statement that will al...
[1 reply] : #include <iostream> int main() { int a ; int b, c; std::cout << ... (by zapshe)
What shouldn't you return from a local variable?
 
Hi. I'm learning C and C++ and read somewhere that you can't return local variables like so #i...
[4 replies] Last: please note that a segfault is not guaranteed, so be careful when codi... (by ne555)
by momof4
Iterating through a list
 
I have a list of blocks that I have created, and I need to iterate through them and draw each one. h...
[3 replies] Last: This sort of problem is why we now have range based for loops: for (c... (by dhayden)
Classes and fractions
 
hey yall , im suppose to do this assignment but i haven't studied classes yet (couldn't attend onlin...
[6 replies] Last: After you watch the videos, search for "rational" on this site. There ... (by dhayden)
C++ regex clarification
 
Can you please clarify if this is the correct approach to retrieve values of "x" and "y" from a give...
[3 replies] Last: Raw strings were probably added mostly for regexes since otherwise the... (by dutch)
Is it possible to initialize a class' reference member inside a copy-constructor?
 
In the copy constructor for Person , how do I create a copy of Alice's pet and assign it to the cop...
[12 replies] Last: doesn't compile, conversion from `int' to `Person*' also, stack overf... (by dhayden)
do while
 
hey pals, have to write a code that : identifies how many times variable b got incorrect values....
[3 replies] Last: thanks (by MaxGreen)
Range based for loop in cpp
 
The below code snippet is python range based for loop with the increment of steps by 2. for ...
[9 replies] Last: You may use C++17 and overload of << operator #include <iostream> ... (by TomCPP)
C++ debugging help
 
I have an assignment where I need to find the area of a cylinder. I am only able to get the output o...
[5 replies] Last: Just for interest sake after a bit of compaction etc ... #include <i... (by againtry)
How to write a method to cout elements (of user-defined type) from sequential containers?
 
I'm designing a little function for general purpose use. The function is called StrItems() and its...
[6 replies] Last: [quote=ElusiveTau]My guess is that execution tries to run to_string(ob... (by Ganado)
by Mif
Can anyone help me with switch loop?
 
The code compiles and I don't get any error the problem is the loop when you choose for the first ti...
[6 replies] Last: glad you got it. FYI c++ does not recommend C-strings and printf, sc... (by jonnin)
Returning values from a void function
 
I am trying to return the values avgTime and avgGross from the void functions but have not been able...
[7 replies] Last: void readFile() - read the contents of the input file Your calcAvgGr... (by dhayden)
Deleting 1 copy of a shared_Ptr
 
Hi,how could I set a shared_Ptr to nullptr? Concourse has a std::shared_ptr<Text> called text. It al...
[9 replies] Last: > I think that may just be a mistake with the const. that's quite a de... (by ne555)
July 2020 Pages: 1... 56789... 12
  Archived months: [jun2020] [aug2020]

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