Beginners - February 2022 (Page 6)

c++ function
 
I have these words ( burger, hamburger, chips, Cola, Sprite), I need to write a function to take pri...
[5 replies] Last: #include <iostream> #include <string> #include <vector> #include <ss... (by seeplus)
pointer / array
 
how to read line number 4, and why we would use it ? int i; ...
[8 replies] Last: It basically means that the address of the first position of the array... (by tahasheikh2k)
by janac
std::greater not working with sort
 
Why isn't std::greater working here? I have two versions of the code below. The only difference is...
[3 replies] Last: L35 sort(my_vect.begin(), my_vect.end(), greater<MyClass> () ); ... (by seeplus)
C- How to properly access and deallocate memory used by a pointer of another struct.
 
So assuming I have two structs where game_t struct has a board_t type pointer to remember all the i...
[9 replies] Last: They haven't taught us to use debuggers yet A debugger is not a pan... (by mbozzi)
Pointer beyond end of array
 
I found these informative videos, but I am bothered by the presence of a pointer beyond the end of ...
[3 replies] Last: That there is a well-defined 'address one beyond the end of an array' ... (by JLBorges)
General questions and guidance from pros (1,2)
 
Hi everyone, I'm in an online C++ video class, about 46 hours of instruction. I'm about a quarter...
[28 replies] Last: That all makes great sense now. better not to make those blanket state... (by Mandavel)
Function is not incrementing correctly
 
Background information: - member is a vector of pointers to Student objects - m is a student obj...
[3 replies] Last: There's a couple. Possibly the easiest is to keep a vector of members ... (by seeplus)
Is there any way to clean this up?
 
I had an assignment where we had to create a program that used a recursive function to test whether ...
[8 replies] Last: or using iterators: #include <cctype> #include <iostream> #include <... (by seeplus)
No matching constructor for initialization error
 
//this is the main function #include <iostream> #include "Student.h" #include "StudentClu...
[3 replies] Last: Why a std::vector of pointers? std::vector<Students> works just as ... (by deleted account xyzzy)
How to swim when jumping in the C++ deep end
 
Hey All! I have been tasked to take over a project. There is no one to help. I haven't looked at the...
[7 replies] Last: @Duthomhas - Great information, thank you. @thmm - Fix bugs & add new ... (by ComputerCowboy)
Menu option that prints the inserted inputs
 
I am writing a simple code that solves a systeam of two linear equations inserted from a user. One o...
[2 replies] Last: Perhaps something like: #include <iostream> #include <string> int ... (by seeplus)
program isn't catching words
 
Hi peoples I'm learning c++ as a college course. This class strictly prohibits using strings, so ...
[3 replies] Last: > This class strictly prohibits using strings, so arrays only There's ... (by salem c)
GUI guessing card game
 
I would like to try to make a guessing card game using GUI and c++ on visual studios. Here is the b...
[1 reply] : The screenshot on Google drive looks like a WinForm application. One ... (by thmm)
by ansch
Confusing output of this code
 
Let me apologize in advance for choosing this unspecific title. I had problems finding a good one, s...
[4 replies] Last: #include <iostream> int f3() { std::cout << " test3 "; return ... (by againtry)
c++ to c
 
Can anyone please convert this code from C++ to C OR just give me a C solution for this problem: ...
[13 replies] Last: In practice, yes: std::numeric_limits<T>::is_iec559 is true on almos... (by JLBorges)
Recursive operator overloading for std::vector
 
This is my piece of code for overloading '+' for vector. template<class T1, class T2> auto op...
[6 replies] Last: @lastchance, Thanks a lot. Now I see where I was tripping. The problem... (by Rakib771)
Questions about validating inputs
 
When I try to cin three integers and cout “not valid” after entering all three of the inputs, it...
[1 reply] : Correct. Once stream extraction can't properly extract, it fails the s... (by seeplus)
For loop creating an odd number at the beginning
 
So I want to print even numbers in reverse from an integer that the user inputs. However, the first ...
[8 replies] Last: You are getting that error because you are not compiling as C++11 or b... (by deleted account xyzzy)
c - reversing an array of strings.
 
My goal is if I have array of strings such as "hello", "world", "dog" calling reverse should ensur...
[2 replies] Last: jonnin - Yes that seems to fix my issue perfectly. I appreciate your a... (by Volapiik)
Help with Heap and Pointers (1,2)
 
Below is my first attempt to use 'new' to allocate heap memory, and 'memset' to initialise the addre...
[20 replies] Last: According to some experts modern C++ is about expressing intent. If st... (by thmm)
February 2022 Pages: 1... 4567
  Archived months: [jan2022] [mar2022]

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