Beginners - April 2020 (Page 10)

by sturk
Not printing out correct values
 
Why is it not printing out the right values? I'm lost. Need help. Thanks. #include <iostream> #include <cstdlib> class cs234 { public: templ...
[2 replies] Last: In push_back you write the value to the wrong location in the array an... (by Peter87)
Need some quick help, would appreciate
 
Hello guys, I have problem printing what I just inputted from line 26th. When I try cout in line 48th I don't get the same results. I should get when I cout : ...
[7 replies] Last: Since original data are too secret to be shared, let’s venture funny... (by Enoizat)
Compiler defines and reading the standard library code?
 
Hi guys, So a two part question here, First off I noticed a lot of C++ code and C code for that matter have strange defines like #ifndef, #ifdef, #define ...
[5 replies] Last: [quote=adam2016]std::vector and other containers, they almost look cry... (by Cubbi)
by pkdir
Return enum with most occurrences
 
If I have an array of structs that contain an enum of type Fruit , how can I write a function using modern practices/features to return the type of Fruit that ...
[1 reply] : Following the KISS principle I would copy the values into a std::map a... (by thmm)
by Zanza
Undeclared identifier in grading program
 
I'm trying to add a menu to my previous program as well as make it more modular by turning the screens into functions. I don't know where I am going wrong to...
[3 replies] Last: This is your code after having removing all the unused declarations an... (by Enoizat)
by hbcpp
Simulated environment for performance
 
I know that C++ is the language of choice when performance is critical, when speed is a must. That's why it is used in many bank systems, embedded devices, and ...
[1 reply] : About the move vs copy speed comparison have a look at this post on SO... (by thmm)
by Faizts
out put not working return value problem
 
#include <iostream> #include<cmath> using namespace std; class Calculator{ public: float Addition(float x, float y){ float ans = x + y; ...
[2 replies] Last: i just fix it not add output tag (by Faizts)
queues
 
I have a queue which represents people waiting in line at a bank. There is also priority queue who has a list of events which contain arrival times and and tran...
[2 replies] Last: That is correct. cust.transaction_start_time is equal to previous cust... (by stoneJax)
by sparki
C+ delete operator doesn't work properly
 
Getting an exception thrown error. #include <iostream> #include <vector> using namespace std; class Shape { public: virtual void Draw() = 0; virtual ~Shap...
[1 reply] : The problem is on line 89. You make a shallow copy and both pointers p... (by thmm)
by DJL
Looping and order of operations help
 
Hello, I am new to C++ and have been working through a bunch of problems for school. Im really stuck on a homework and Im hoping to get some guidance on what I ...
[13 replies] Last: You can always make your own swap like this: double temp = start; s... (by dutch)
by alexko
Colon sign with case and enum
 
Hello. I tried to find an answer and all of them in the archive, but they didn't explain my example. Or maybe I didn't get it. int calc_mode=(int)SymbolI...
[6 replies] Last: https://www.learncpp.com/cpp-tutorial/53-switch-statements/ (by deleted account xyzzy)
How to skip over a space when my while loop is supposed to stop at a space.
 
Hello! I really appreciate how this forum helped me understand my assignment. I have started on it but now I run into a problem and I don't really know how to g...
[1 reply] : else if (c == '@') { while (!stack.empty() && stack.top() == ' '... (by dutch)
by flav32
Creating singly linked list
 
Is there any way to work with linked lists without writing the CreateList() function every single time? I'm having a really hard time understanding this chapt...
[5 replies] Last: Thank you! I understand the concept, the logic behind them. I could de... (by flav32)
Converting a input string (HH MM SS) to an int (HH:MM:SS)
 
I have to write a program that takes two different inputs (lets call them FirstTime & SecondTime) and then convert the two times to seconds , get the difference...
[6 replies] Last: You could also use regular expressions <regex> for this, but given tha... (by TheToaster)
do while loop, invalid user inputs....
 
Hello, So I am trying to get this loop to take in values and check if they are within my requirements. The input will be invalid if the number of lines(lines...
[3 replies] Last: @TheToaster, I knew i had to reset that and for whatever reason I was ... (by Dustin792)
C++ Joystick
 
Hello, im kinda new to C++, im making a game and want to use a controller for it, i made also bullets and used a formula for it (so i can shoot 360 degrees arou...
[1 reply] : I guess you start here https://www.sfml-dev.org/documentation/2.5.1/cl... (by salem c)
Classes, objects, points
 
Hello my friends I have a question that is very important for me i should write this : 1. Write a program that implements the MyPoint point class as follow...
[3 replies] Last: thank u @Handy_Andy i'll do (by closed account EwqDy60M)
Using an array to manipulate Pi to specific decimal Place
 
I have a class assignment where I have to take pi as a constant and set it to a user desired decimal place. The last digit cannot be rounded so the use of setpr...
[8 replies] Last: It sounds like you're expected to do floor(pi * 10^input) * 10^-input. (by helios)
How to implement classes
 
Hello, so i am very new to c++ and i have managed to create this code bellow. but i have to use classes to do so. I am very lost how to break this up into class...
[5 replies] Last: Hello jtek679, In addition to what dutch has already said. When yo... (by Handy Andy)
Cannot convert int to double
 
Hello, a beginner currently learning highest values. Been trying to find the highest amount of mushrooms collected in a task, but keep getting this error: ...
[5 replies] Last: Thank you so much!! Both of you are lifesavers! (by starhan)
April 2020 Pages: 1... 89101112... 20
  Archived months: [mar2020] [may2020]

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