Beginners - May 2022 (Page 3)

Can you create an instance of a class using a variable?
 
Duplicate of http://www.cplusplus.com/forum/general/283588/
[no replies]
Creating Class Objects and Pushing Back to a Vector
 
Here I wrote some wrong code to tell my problem. I want to create a class object and at the same time, I want it to be pushed back into the vector. As a beginne...
[4 replies] Last: For JLBorges, thanks for your kind suggestions. I still don't know abo... (by bydrachen)
Is it normal that smart pointers can't solve a problem?
 
Hi! I was wondering how normal it is that a problem can't be solved with smart pointers? On my current project I can't seem to use smart pointers (which I am a...
[4 replies] Last: A better question might be: "Is it normal that pointers can't solve a ... (by George P)
A beginner's class and assignment. May a little bit help?
 
Hi! Currently, I'm learning C++ classes and object oriented programming. It's hard for me to learn because this is my first language. I have an assignment and I...
[3 replies] Last: Thanks for your kind suggestions jonnin and seeplus. I tried to apply ... (by bydrachen)
Writing a function
 
Write a function, computePrice that receives two parameters: the first one is a character variable indicating the size of the pizza (S, M or L) and the second a...
[2 replies] Last: thanks , So I was kinda on the right track at the beginning (by blackpanther35)
NumDays Class
 
Essentially I was creating a class called NumDays where I convert the number of hours into a day since the problem stated there are 8 hours in a day. So I ...
[4 replies] Last: The pre-inc/dec operators are still not as expected by convention. pre... (by seeplus)
issue with a loop and maybe sentinel?
 
My instructions were to make the program run until a sentinel was entered, in this case my sentinel was any negative number, however I want the program to imdei...
[11 replies] Last: It's easier if you make input as a function: #include <iostream> i... (by seeplus)
by kingsy
Newbie - Tips needed
 
Hi, I am new here. Just started learning C++ out of interest. All helpful tips to succeed in this journey will be highly appreciated. Best.
[4 replies] Last: Thank you seeplus. That was really insightfuil. (by kingsy)
Find the right root
 
Hello everyone, may I ask that given size, nodes and edges of a tree. How can I find the correct node to be the root so that the maximal number of nodes in subt...
[14 replies] Last: Greetings, thank you for your help, solved now. (by satsat111)
Segmentation fault in code
 
Good morning. I'm new to programming and need some help. I'm getting segmentation fault in the if statement with the following code. void delete_car(car_da...
[14 replies] Last: keskiverto thank you for your help, but the code is now fixed. I corre... (by plastic)
C++ Oscillator not confirming finding sound source or emitting wave
 
I'm trying to follow along in a tutorial of how to code to an oscillator on youtube. Idk if I can link the video without breaking rules here. I am using codel...
[3 replies] Last: A meta-search link might be helpful to find easier to use ideas. http... (by George P)
Outputting each instance value.
 
Hello I have a problem outputting each value for the getIndvCost() function and I wanted to see if anyone knew how to output them using pointers. //John...
[6 replies] Last: There is more than two valid syntaxes, are there? (* ptr ). addPrice... (by keskiverto)
Calculate Average
 
Complete the CalcAverage() function that has an integer vector parameter and returns the average value of the elements in the vector as a double. Ex: If the ...
[9 replies] Last: I think it depends how many numbers you have and how big those can get... (by kigar64551)
Weighted graph
 
Hello everyone, I got problem putting the weights of each child's and getting the max weighted child among them in the code. Some said that this should be solve...
[4 replies] Last: Hello, actually I discussed with my friend and a friend of mine gave m... (by satsat111)
Displaying data from file
 
So i have a dat. file that holds 500+ user data information. I want to be able to sort the data into arrays and display it if the user selects that option. ...
[12 replies] Last: And, in that vein, here is a solution looking for a problem using tupl... (by againtry)
How do I loop this?
 
I have to use a function getData aswell as displayOutput and make a for loop so so that it can loop 5 times. Heres What I got so far #include <iostream...
[9 replies] Last: Notice the detail: if (volume < 100) { std::cout << "Size: small\n... (by keskiverto)
list<T> within a template ?
 
#include <iostream> #include <list> using namespace std; template <typename T> void DisplayContents(const T& inList) { //list<T>::const_iterator ele...
[6 replies] Last: > I know what the rest does, but still trying to figure out what.... >... (by JLBorges)
Find Lowest and Deduct
 
Write a program that calculates the average of a group of test scores, where the lowest score in the group is dropped. For example: if the user enters the value...
[3 replies] Last: I have corrected it , it works now! (by Anonomys)
by jNc
OpenCV related, get item from vector of cv:Point
 
Write your question here. string path = "man.png"; Mat img = imread(path); Mat matrix, imgWarp2; std::vector<std::vector<cv::Point> > conto...
[3 replies] Last: solved, thank you (by jNc)
by Pen72
Euler order
 
Good morning, I'm trying to write a program to print the Euler Tour order on a tree. But the code isn't successful, is there any problem regarding the way I inp...
[12 replies] Last: Hello, thanks a lot for the great help!Passed all cases now. (by Pen72)
May 2022 Pages: 123456
  Archived months: [apr2022] [jun2022]

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