Beginners - April 2019 (Page 8)

forward_list.erase_after seems to return an iterator to the erased element?
 
I am learning C++11 on my own using C++ Primer. I'm supposed to write a program using a forward_list<int>. The program should iterate through the forward_list, ...
[7 replies] Last: No problem, and thank you for showing me the before_begin method w... (by Peter87)
by ICantC
std::forward_list erasing
 
I'm used to working with vectors but I'm trying other data structures for fun, below I am trying to remove an item in a forward list, it doesn't have erase, onl...
[6 replies] Last: I just learned about before_begin() which allows us to simplify the ... (by Peter87)
Passing Member Function as Parameter to Another Member Function
 
I want to be able to pass a function as a parameter to another function within a class. In the example below, I want to pass 'Function_2' or 'Function_3' into...
[2 replies] Last: Thanks helios that's great! (by calioranged)
by JayGln
Best programming practices
 
Thank you first for reading my post. I have my final data structure and algorithms project coming up and I really want to do a great job and have this as someth...
[4 replies] Last: These are great suggestions thank you. I do know I am procrastinating,... (by JayGln)
strlen
 
I am trying to write a member function that returns the length of a dynamically allocated c-string. I have some code up but it is not correct and I get a warnin...
[3 replies] Last: That was it. Thank you so much! (by stoneJax)
Assignment
 
Write your question here. Create a class called student. This class contains data members for name, roll no, and CGPA of a student. Provide a no-argument ...
[1 reply] : #include <iostream> #include <cctype> #include <limits> int main() {... (by George P)
Implementing polymorphically
 
We want to allow our pets to communicate, so let's add a public member function to the Pet class called speak(). This should be implemented polymorphically s...
[2 replies] Last: Dynamic polymorphism is done in C++ through inheritance and virtual ... (by Ganado)
Trying to convert float to int with type casting operator
 
Hi, I'm going through the tutorial and I'm on operators. When i enter the code demonstrating the explicit type casting operator and try to print it to the scree...
[3 replies] Last: Okay, thanks! I didn't think about that i should've remembered that th... (by doodoohead01)
Compare Strings
 
I have an overloaded < function that is to compare if two c_string objects are equal or not. I get an error saying no acceptable conversion. Can someone point m...
[8 replies] Last: Your'e right it works. I had one line before that, s2 = '!';, to test... (by stoneJax)
Population estimator, for loop not adding to variable and file is empty
 
For a class assignmet I have to make a population estimator. Here are the specifics: In a population, the birth rate is the percentage increase of the popula...
[2 replies] Last: Yes, this helped me, I found out that I had File instead of file insid... (by Detslibli)
Trouble writing files
 
I can get it to build but it wont run. what am i missing. Put the code you need help with here. //Specification: Append and display records in a addres...
[1 reply] : You're missing and ending code tag! I laugh at my own puns. Anyway, i... (by zapshe)
by Myro
Adding emp.totpay together
 
So I'm trying to finish this code up I have one function to complete and that is to add up all the employee.totpay together to return a value, that is then disp...
[3 replies] Last: got it double Payroll(incomeInfo employee , int NUM_EMPS) { doubl... (by Myro)
Constructor
 
I am starting a new project on classes with dynamic memory and I am trying to make sure that I correctly understand the set up of the constructor. The instru...
[5 replies] Last: stoneJax wrote: I am not sure of the differences between, or how... (by anup30)
Operator overloading question
 
Hye so this is a code which I found on the internet.We have to add, subtract multiply rational numbers but with operator overloading. I am not getting what he ...
[7 replies] Last: Style choice with practical benefit. The public members are introduce... (by keskiverto)
Struggling with c-strings and arrays
 
The function is supposed to take an output file from the command line input. The function is supposed to output and array of strings one character at a time ver...
[2 replies] Last: The function "verticalWords" at the bottom doesn't have the same param... (by zapshe)
by gjur99
Structures with arrays help!
 
hello! i wrote this code, but i am having some issue with fiding the higiest value stored in p .points_scored corresponding with the player who scored it. but I...
[4 replies] Last: //find the player with the highest score Is the function meant to... (by Repeater)
Sharing objects between functions
 
Sharing objects between functions Hello. I made myself a class for storing textures and loading them from files. It's quite a simple class. Internally it ...
[7 replies] Last: Good luck. Hope you find what you're looking for. (by Repeater)
D&D initiative tracker program
 
I been trying to make a program for my charter and I got it all down so I can just type in afew words to look up states or spells but now I wanted to add a comb...
[3 replies] Last: yes, I get it. I would store all the players in a vector. roll/ co... (by jonnin)
Problem in making operator overloading function a friend of class
 
I am trying to create a program which will have two classes of rational and complex numbers. I made two global functions for their addition and then made those ...
[3 replies] Last: When confronted by a list of errors one line of attack to fixing them ... (by George P)
need help with a input function
 
I need help, I have the whole program written I just need a function where it asks the user to pick 3 of the 5 cars and compares them, like what I have. It comp...
[5 replies] Last: Heh, I really do need coffee and lots of it. The comment at line 40 I ... (by George P)
April 2019 Pages: 1... 678910... 24
  Archived months: [mar2019] [may2019]

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