Beginners - May 2019 (Page 11)

Mutator
 
I have some classes set up based on inheritance and I am trying access a mutator function setHitpoints() in the base class from the client program. I am display...
[10 replies] Last: I was able to complete the project, and I appreciate the help. Thank ... (by stoneJax)
Thread Bad Access Code Binary Tree
 
Hello, I am currently working on this project for my CS class and I am trying to find the number of binary tree nodes that are single parents. So I put some co...
[2 replies] Last: 1. Your indentation needs work. 2. Omitting the stackType presumes th... (by salem c)
by Ivitoh
Line not being well read
 
Hello, I have a problem when reading lines in a text, passing them in to a list<string> (I must use this) and then evaluate and do the actions the text says. Le...
[3 replies] Last: Ah, for the IF. "IF ( a = 5 )" This is 6 tokens:    IF required... (by Duthomhas)
switch vs if else statement
 
Hi guys! I have little doubt about which one is better to use? Statement switch or statement if else?
[4 replies] Last: which one is better to use? Switch of C++ is somewhat limited in con... (by MikeStgt)
How to include external library in Code::Blocks.
 
Hi guys, I'm really new to C++, mostly I'm trying to learn what I can from youtube for a spelling program I had in mind. In the program, the computer says...
[5 replies] Last: Update: I got boost working. I am now going to do the same for the oth... (by FreedomLantern)
Getting todays date and adding 24hrs (1,2)
 
Im having some trouble figuring out this this part. We are working on a small project that creates bus tickets that have several classes i.e. 24 Hour ticket, t...
[22 replies] Last: most systems properly handle DST with localtime() I wonder that in t... (by MikeStgt)
Day, Month Date Calculation.
 
This code works. #include <iostream> #include <string> using namespace std; class DayOfYear { private: public: int MonthDays = {0, 31,...
[4 replies] Last: It is a very good effort though. Add code to compute whether or not y... (by Duthomhas)
New way on how to find area of a circle
 
SO I need to find the area and circumference of a circle right? Normally I can do this in my sleep,but I've learned a new way on how to do this with "class" "pu...
[2 replies] Last: Oh! wow now I feel dumb. Thank you for the help man! (by Deadweight77)
Solved
 
It's been solved, thank you!
[8 replies] Last: please don't edit your original question with "it's been solved, thank... (by adam2016)
Convolution of dice
 
I have a biased dice with probability of throwing 1,2,3,4,5,6 as 0.35 , 0.10, 0.05, 0.05, 0.15, 0.30 respectively. now I want to calculate the expected value o...
[3 replies] Last: Sum[i+j] += prob1 *prob2 ; (by ne555)
C++ / C interesting questions - best practice vs. inovation vs. brainstorming
 
1) Which data structure would you use to store 1000000 intigers? 2) Which data structure would you use to store 10 000 000 telephone numbers? 3) What search alg...
[5 replies] Last: 1) Which data structure would you use to store 1000000 intigers? 2) W... (by MikeyBoy)
nim game
 
I've tried many codes but I'm still failing. I mainly tried this: if n = 155 and m = 47 then among 47, 94 and 141 select the best one to deduct from 155 but I s...
[14 replies] Last: > and also @neutralove method doesn't seem to work for all test cases ... (by ne555)
function object as parameter of std::thread object
 
Why use '&' symbol in the code bellow, when thread object called like "std::thread t(&X::do_lengthy_work, &my_x, num);"? In other words, why use object referenc...
[2 replies] Last: > In other words, why use object reference for function object as the ... (by JLBorges)
by bsr
"vector subscript out of range"
 
Hello, I am working on a graph algorithm but I have a problem. It seems that my problem about adding elements to a vector but I can't fix it. Can anyone help me...
[11 replies] Last: Thank you very much @keskiverto (by bsr)
PPP - chapter 16 - flkt wrong screen resolution
 
I'm currently working my way through Bjarne Stroustrup's Programming, Principles and Practice and I'm currently in chapter 16. My problem is that full tick or w...
[5 replies] Last: I should mention that when I create a 1280x680 window, it indeed does ... (by grumblesnake)
Classes Communication
 
It seems like this should be basic but I am not seeing where I need to communicate the data here. This function gets called on by creature objects from two diff...
[7 replies] Last: I talked to my instructor and it turns out that I was misinterpreting ... (by stoneJax)
Resizing of array - Giving Run time error at deletion of memory
 
Following is my code, #include <iostream> #include <fstream> #include <string> using namespace std; class Student { private: string name; str...
[6 replies] Last: Oh, not only was I writing the wrong syntax but also my logic was wron... (by redfury)
min and max element is list (1,2)
 
Hello! How can i find minimal and maximal element in list? I think i must start with function for sorting but how to put in dynamic initialization without STL? ...
[25 replies] Last: Yes. Both max_value() and print() are recursive.... (by JLBorges)
How can I make this shorter?( and more efficient)
 
Trying to make this more efficient if ( score < 60 ) { grade = 'F'; } if ( score >= 90 ) { grade = 'A'; } if ( score >= 80 && score < 90...
[9 replies] Last: among all these codes lastchance's program is the fastest. and th... (by anup30)
Graph
 
Hello! Please help me. How to create a function that tells you if there is a tip in a particular graph? #include<iostream> using namespace std; const in...
[2 replies] Last: I have no idea how a non-C++ symbolic algebra system relates to this. ... (by Duthomhas)
May 2019 Pages: 1... 910111213... 16
  Archived months: [apr2019] [jun2019]

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