Beginners - July 2018

how do i operator overload <<?
 
it is said that the it must receive 2 parameters. 1)istream reference(e.g cin)//receives value from cin 2)object reference//to put the values received from cin...
[3 replies] Last: @coder777 Interesting. Usually I've seen the friendship just declared... (by icy1)
What book to read after starting out with c++ by tony gaddis?
 
I asked this question in StackOverflow and they didn't answer my question and just linked me to an old question that did not have the answer I was seeking. I ho...
[4 replies] Last: ^ that auto-bot response from Scarlet Klark. Reported. Adding to w... (by icy1)
by ysf007
how to know the progress of each thread ?
 
Hey, In fact, I'm a beginner developer in C++, and while dealing with threads to process files, dig data structures etc, a question comes to my mind. how do I...
[3 replies] Last: @JLBorges thanks a lot (by ysf007)
Loop help
 
So I need my main to loop back to asking for input after it provides an answer. I forgot to do this before creating my main. SOS need help putting my already bu...
[1 reply] : #include <stack> #include <iostream> #include "calc_useful.h" using n... (by Repeater)
Raise an event and begin listening to it (part 2)
 
Sorry fo this second thread about raising events, i opened a new one cause the first thread (http://www.cplusplus.com/forum/beginner/171441/) has been closed. ...
[3 replies] Last: It won't work unless it's C++11 or above (which every sane person sh... (by Ganado)
by runzhi
A bug from c++ primer plus - no one discovered
 
I had just a problem with the sample code written in c++ primer plus 6th edition page574-code 14.15 stcktp1.h and code 14.16stkoptr1.cpp The author declar...
[8 replies] Last: Line 6 and line 11 is called a default member initializer . It will... (by Peter87)
by thmm
SIGSEGV on codechef
 
When I run the following code it works fine on my Windows PC under Code::Blocks 17.12, but I get a SIGSEGV on codechef. What's wrong #include <iostream> ...
[2 replies] Last: Thanks, I added the check for the size and it solved the SIGSEGV probl... (by thmm)
String type allowed in copy constructor?
 
I am using an example from Sams Teach Yourself C++ In One Hour a day. I pretty much understand concepts relating to the copy constructor. A couple of things tha...
[3 replies] Last: OK @Ganado, @tpb I see. I am learning about the keyword explicit. This... (by bistelA0005)
Trouble initialising base class members
 
I'm trying to put new values when I intialise the object from the derived class, but I just can't figure out why it's not working. Can someone please tell me wh...
[4 replies] Last: Yes that does work, and makes sense too. Thank you both for the repli... (by Hollowman)
Find number of coprimes with a given integer in a specified range.
 
I was recently asked in my interview for a way to find the number of coprimes with a given integer N (1 <= N <= 10^9) in a range [L, R] (1 <= L <= R <= 10^18). ...
[13 replies] Last: @Jonnin this interview was for a getting a PHD seat under a Professor ... (by shitstar)
by lic14
Edit vector from a file help
 
So I'm creating a program that lets me read a list from a file (Filled with Numbers), allow the user to update (erase, add) and change the starting sequence of ...
[3 replies] Last: @lic14, all this stuff would be easier if contained in a class, and th... (by icy1)
recursion help (i think)
 
Hello all and thank you advance for any help that is provided. I am trying to figure out how to create a function or just a line of code that will allow me to ...
[4 replies] Last: [quote=icy1]Title of this thread should probably be renamed to "dot pr... (by lastchance)
Count++ not adding to initial count
 
Hello, I have spent hours on this project and am hoping for some help. I have been trying to get my counts to work but every time I run the program it outputs 0...
[4 replies] Last: What's w/ all the unused counts? Should probably append those to thei... (by icy1)
first usage of headers
 
Hi, another question of mine: Suppose I wanted to use a function in my main() that is written in another file. I have read that you have to uses headers the...
[4 replies] Last: @jlb thank you, this makes sense! So in my main() file, the compiler ... (by PhysicsIsFun)
C++ IDE that allows for "scripting"
 
I'm currently using Visual Studio to practice C++, but I've noticed that within a Visual Studio "solution" if you have more than one .cpp file that contains a ...
[1 reply] : I think you confuse solutions with projects. A solution can have many ... (by Thomas1965)
I am trying to learn cin.fail()
 
I am trying to do input validation to make sure nothing but integers are entered but I cannot get it to work right. I have watched video tutorials. What is happ...
[7 replies] Last: Thank you Andy. I got it solved but am still learning. I did use this ... (by lkordich)
threadsafe lookup table,
 
Hello, I am writing a threadsafe lookup table with buckets of linked lists and am running into a Access violation (line 113) which I have trouble understanding ...
[1 reply] : #include <iostream> #include <unordered_map> #include <mutex> #includ... (by JLBorges)
finding max cost and printing string
 
So I am having trouble finding the max price from a list of parts that is in a .txt file. I need to find what the highest cost is and cout the part number (str...
[2 replies] Last: Thank you for your response, I knew I wasn't far off. I don't think I... (by justStarting)
Creating a dp table
 
I want to create a DP table sudo code goes like this f(n,k): if(n==k) return 1; if(n==0) return 0; if(dp !=-1) return dp ; b=f(n-k,k)+f(n-1,k-1...
[9 replies] Last: Only two people solved this one. Here's a cleaned-up copy of the short... (by tpb)
Less complicated way of changing variables of class instance from another class
 
Take a look at my below example. I want class B to be able to change the variable "x" in an object of class A. Sure I can pass in the object into the constructo...
[6 replies] Last: Thank you for the link! I thought newClassAObject would simply refer t... (by Crusher21)
July 2018 Pages: 123... 17
  Archived months: [jun2018] [aug2018]

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