Beginners - February 2022 (Page 6)

c++ function
 
I have these words ( burger, hamburger, chips, Cola, Sprite), I need to write a function to take print like these: Chose your order from (0 - 4) 0: Burg...
[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; int numbers ; int* iPointer; ...
[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 in the first I used my function cmp() as the third parame...
[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 information about the board. The board member variable cells ...
[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 an array. Is it common to see pointers go beyond scope and b...
[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 of the way through the class, really enjoying it and excite...
[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 object - I am trying to add pointers that point to a Student o...
[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 a string is a palindrome. We had to have a value-returning r...
[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 "StudentClub.h" #include <vector> #include <iomanip> using namespa...
[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 code yet, but was told it is C++. Will someone PLEASE give...
[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 of the options of the Menu is to print the inserted equations...
[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 arrays only Part of our homework was to write a function ...
[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 brief description of the guessing card game on the google doc...
[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, since i dont really get what the problem here is. So given...
[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: Positive number N, find all combinations of 2 * n elements s...
[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 operator+(const std::vector<T1>& vec1, const std::vector<T2>& ...
[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 turns out that as soon as the first integer is not valid(fo...
[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 number that gets outputted is strange and I cannot understan...
[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 ensure it becomes "dog", "world", "hello". In reverse, char*...
[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 address indicated by a pointer. When using memset - How coul...
[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.