Beginners - April 2019 (Page 23)

Copying class objects
 
Hello, I had a question re. copying of pre-defined types(int, doubles etc..) and user-defined types(classes for example..) If we have the following code: i...
[9 replies] Last: it was just an example, I didnt even look at your variable names. if... (by jonnin)
Multi-File Program Linking
 
This question, I probably should have asked long ago, but I am thinking I am doing this linking of files all wrong. I have a base class, and its .h & .cpp th...
[5 replies] Last: > and in main #include all my .cpp files > I guess that is what you we... (by salem c)
Explanation as to how this code works? Using a string for mathematical equation
 
Hello, I am trying to write a program in which I will be using a string to add or subtract a mathematical equation. That is, a mathematical equation will be inp...
[2 replies] Last: #include <iostream> #include <sstream> #include <string> using namesp... (by lastchance)
rand() and its operator %
 
can someone explain clearly how to use rand() and what it does, as well as its relationship to %. the guides on these forums are confusing. from what I can gath...
[13 replies] Last: #include<iostream> #include <random> #include <chrono> #include <cstd... (by George P)
by itsk
Elements in array not changing
 
For my class I need to change the smallest and largest element in an integer array to 0, and then take all the numbers and find the average afterwards. For some...
[7 replies] Last: Oops, all I had to do was change the array element to be null and it w... (by itsk)
Capitalise the first letter of each new word.
 
Hi, im looking to find out how to capitalise the first letter of each word entered. any help would be greatly appreciated. #include <iostream> #include <std...
[2 replies] Last: You should indent you code consistently. You've mixed the old and new... (by dhayden)
<random> and <chrono>
 
alright correct me if I am wrong in my evaluation of this code, im trying to understand how this works and I think I have figured it out. (BTW this is code I w...
[5 replies] Last: std::mt19937 generator(seed); puts that number into distribution(gen... (by Peter87)
How to limit integers per line (for loop)
 
The loop is to print all the even numbers from 100-200, with 10 per line. Currently it is printing in a triangle formation. I am unsure how to limit the number ...
[1 reply] : Here's one way you could do it: #include <iostream> int main() { ... (by Cheddar99)
Undefined reference to `cv::cvtColor' even though library libopencv_imgproc is linked.
 
Hi, I know there is a lot of similar questions on the Internet, I just can't figure out this on my own. Do I have wrong linking order? g++ ../../source/Ma...
[4 replies] Last: @salem thank you for answering this. You've saved my life, I've wasted... (by Unspoken)
Cannot reading .csv
 
I have a program: #include <iostream> #include <fstream> #include <string> #define MAX_SCORE 100 using namespace std; struct Scoreboard { st...
[5 replies] Last: Got that, thank you! Sorry for late reply! (by thinhphucvang)
Visual Studio Not Responding
 
I am using the latest version of Visual Studio Community and it has started some strange behavior. Any code that I create will not get displayed to the terminal...
[3 replies] Last: Do you have any anti-virus s/w running? Since .exe files you create ... (by salem c)
trying to use a function to complete this program but cannot get it to execute properly
 
please tell me if you see where my mistake is in this program cannot get to execute Complete the program using a function. The program should read all the v...
[3 replies] Last: Your loop contains TWO in >> value; One in the loop test, one in the... (by lastchance)
Is there any way to store tm values using Boost?
 
Basically I'm trying to store a value, map<string, Date*> m_dates, into a data file. This map uses a string and Date, with a Date class being composed of: tm ...
[1 reply] : This doesn’t answer your question, but can be a (awkward) workaround... (by Enoizat)
Is there a way to represent an integer character?
 
I am currently creating a find function to locate a specific piece of data in a different lines. Using the std::size_t found = data .find(str); However the prob...
[10 replies] Last: I managed to get the loop to work but now I have a new problem, when I... (by nicholasjb1996)
Organizing program problem
 
Hi there i was wandering how can i divide my program into parts so i can write it easily when i watch youtubers writing codes it seems like it's too easy to ...
[2 replies] Last: There's "top-down" where you start with the highest level stuff and th... (by dhayden)
by ramp00
Testing for user input
 
At the moment if I enter a string first, and something that's not an int second it will just end up in an infinite loop running the else statement. How do I so...
[2 replies] Last: Oh okay, sorry.. Thanks a lot! (by ramp00)
Writing (almost) everything as library component!!!
 
I don't think that 'cpp core guidelines' recommends a single header. So yes, the first concept would be 'divide and conquer'. Therefore namespace are invented....
[9 replies] Last: Whether the posts were spam or not is rather a moot point now, they've... (by George P)
Keywords vs identifiers with special meaning!!!
 
Using a keyword as an identifier is a very bad idea. It may work with some compilers and not others. It make work in certain contexts and not others. Most c...
[6 replies] Last: Well, I only saw one of the spammer's posts and didn't immediately see... (by Ganado)
Program run without return
 
The program runs fine without any return i wanna know what's return statement do exactly?
[2 replies] Last: return sends a value back to the caller and exits the current function... (by jonnin)
Accessor inside a child class
 
Hi, Could anyone help me out with creating an accessor function that will allow me to work with a private parent double inside a child class .cpp file? I unde...
[1 reply] : If it's just a simple accessor ("getter") you need, then something li... (by Ganado)
April 2019 Pages: 1... 21222324
  Archived months: [mar2019] [may2019]

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