General C++ Programming - May 2019 (Page 3)

Copy Assignment Operators?
 
I’m still unsure about return statements versus return values. So for a copy assignment operator, what would he return statement be? And what would the return...
[4 replies] Last: @keskiverto Absolutely correct on all counts, my error. Thanks for c... (by SimpleCoder)
Can't reserve a <vector> of a class object (complier error)
 
I have two classes WxMonth and WxWatch , the first containing a <vector> of the second. In the header file, I can declare: std::vector<WxWatch> mMonthWx; ...
[3 replies] Last: @dutch, @Niccolo Thank you, both. Solved. That was the problem. (by SimpleCoder)
Assignment help
 
I have got homework. but I am busy with my exams. anyone help me in doing this assignment. Thanks in advance. 1) Build an application which populates (Build...
[2 replies] Last: Please note that this is not a homework site. We won't do your homewor... (by keskiverto)
Throw exception from Destructor
 
Is it a good idea to throw an exception from a Destructor? What happened if exception throws from a Destructor?
[3 replies] Last: C.36 is a more specific guideline: https://isocpp.github.io/CppCoreGui... (by Cubbi)
Tricky interview question
 
I was asked at interview : "What is the purpose of such function ?" template<typename T> bool foo(const T& t) { return t == t; } And I don't ha...
[17 replies] Last: To avoid confusion, this behavior occurs under the GNU implementation ... (by mbozzi)
Windows 10\Windows Defender: Code blocks
 
i'm using Windows 10 with Code Blocks... if i disable the Windows Defender, the compiler can create the exe... else i will get these error: "ld.exe||cannot op...
[4 replies] Last: i added the exe file and works now.... but if i do the same on another... (by Cambalinho)
OOP mess.
 
Im just starting to get into OOP and i'm struggling with this program. I need to Create link list with inheritance. Once list is created calling a push from t...
[5 replies] Last: Here are class definitions that I used to implement this. I've also in... (by dhayden)
by Ashh
c++ won't read my else if statement for calculation
 
Hi, I'm having a problem at the else if statement. If I enter PT3 for the category, P for package and when I choose 'D' in if for the code of time, the calculat...
[2 replies] Last: what language is that from? It looks a little like how excel does con... (by jonnin)
assign value of boolean equal to validity of statement
 
#include <iostream> #include <fstream> #include <algorithm> using namespace std; int main () { ifstream fin ("measurement.in"); ofstream fout ("measure...
[2 replies] Last: Is this correct already? YES. you can also treat boolean expressio... (by jonnin)
Doubly Circular Linked List
 
I need help implementing a Push function for a Doubly Circular Linked List. This is what I have so far: //inserts t at the front template <typename T> void L...
[7 replies] Last: @ keskiverto That breaks it. (by Duthomhas)
Doubly Linked List
 
How can I write a code for this Push function: template < typename T > List<T>::Push(const T&
[1 reply] : Are you still in the circular list of yours: http://www.cplusplus.com/... (by keskiverto)
Trouble passing instances of another class to another class
 
Hello. I am still new to object-oriented programming in C++ and I'm having difficulty in dealing with classes. We are tasked to create a multiplayer game in sch...
[3 replies] Last: Nevermind, I have already fixed the error. Oh and thank you @whiteni... (by goodbyeworld)
Throw exception in Constructor
 
Is it a good idea to throw an exception from a constructor? What happened if exception throws from a constructor?
[4 replies] Last: Thanks JLBorges and Duthomhas. You guys are really great. :) (by akash16)
c++ exercise for school
 
Hello guys, so I'm supposed to create a program which has to print the highest offer of a group of donators. The group of donators's information has to be manag...
[3 replies] Last: Unfortunately, the point in CS 101 classes is often to learn how to tr... (by Duthomhas)
critical hit system, C++
 
I am trying to create a simple hit and critical hit system. from using a random number from 1-10 that then has a 20% chance for the user to get a critical hit a...
[6 replies] Last: do { if (counter == 0)// if the counter variable is 0 it is the pl... (by AbstractionAnon)
Need help sorting matix
 
Hi I'm trying to write a program to rearrange a two different matrices such that the numbers below each number in the diagonal are smaller than the diagonal num...
[8 replies] Last: You aren't quite looping correctly. The structure should be: for each... (by lastchance)
Date file addresses on other computers
 
Hello. I've been working on an application that reads and writes to a data file. I have everything working fine except that when other computers try to use it, ...
[8 replies] Last: No it'll be in the current working directory. I wonder where the wor... (by zapshe)
Can't get calculations right
 
I'm writing code to make a basic Rational class but i keep hitting a dead end. My r1.add(r2) keeps resulting in -426974861 / 44086 (should be 5/2) ...
[6 replies] Last: If you can't change the header, you could just have all constructors c... (by dhayden)
by hixtus
Incorrect/Partial Output - Stuck please Help!
 
Hello! Please help. I'm stuck. Thank you so much :) I was tasked to create a program that would output the shortest paths to all other nodes . So for example...
[6 replies] Last: So... I’m doing a really terrible job of explaining this stuff. Als... (by Duthomhas)
Program is in infinite loop for some reason.
 
#include <iostream> using namespace std; int main() { int question; int play; cout<<"Hello, and welcome to my MAGIC 8 BALL! \nWould ...
[3 replies] Last: PLEASE learn to use code tags, it makes reading and commenting on your... (by deleted account xyzzy)
May 2019 Pages: 12345... 7
  Archived months: [apr2019] [jun2019]

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