General C++ Programming - December 2020 (Page 2)

value truncated, undesirable
 
For the following function, N in "n=" line has 3 values when executed N=[0, 0, 586218.1824]. When I break it down to C = (N.at<double>(2))the 586218.1824 h...
[4 replies] Last: This worked great, below, thank you: ... std::cout << "std::setprec... (by technologist)
Sorting coordinates stored in 2d array
 
Hello! I've been recently working on graph problems and problems with coordinates, and I found that if I knew how to create a specific function, it would be qui...
[4 replies] Last: > Now this means that if I ever need the Nth coordinate, > I could ea... (by JLBorges)
Function for returning total weigth of a train
 
How can I override a function to return the total weigth of a train?? class TrainRoute { .... int totalWeight() { return 100; } } class FreightTrainRou...
[1 reply] : To override a function, you have to declare it virtual in the base c... (by AbstractionAnon)
Algorithmic Truck Problem
 
Hello! I've been working on programming problems involving graphs, and I found an interesting one I just couldn't get an efficient program for. So the problem g...
[3 replies] Last: I think I should have mentioned, if both trucks reach an intersection,... (by BBrandon)
Finding an optimal solution to a system of linear equations in c++
 
Here's the problem: I am currently trying to create a control system which is required to find a solution to a series of complex linear equations without a u...
[3 replies] Last: when I did controls algorithms, it was often, but not always, the case... (by jonnin)
How to define a non blocking input in C++
 
0 I'm making a multithread application in C++. In particular, a secondary thread is involved in input operations, the problem is that std::cin is a blocking i...
[1 reply] : Standard streams are inherently blocking. If you need non-blocking con... (by helios)
having a few problems with my code - output
 
Hey all im trying to get my code to work but I get a few errors in the int main Anyone able to help me? I believe the root of the problem is in line 150 but I ...
[2 replies] Last: As you are using fixed size record file binary read/write for the clas... (by seeplus)
Almost done random number generator. Help please
 
The OP post has been deleted. Quoted here: [quote=olorin82]Hi I can make the program generate random numbers but still it should the following: Create a lott...
[8 replies] Last: Seeplus, your code runs well on my 64 bit g++ --version 8.1.0 (mingw)... (by oggin)
by Feit
How to find the index of a randomly selected element of an array in C++ (1,2)
 
Hi all, I am new in C++ programming. I need to randomly choose an element from an array and then find out the index of that chosen element. I coded it in M...
[24 replies] Last: @Feit - done! (by seeplus)
Question about reinterpret_cast usage
 
Hello. I recently was wanting to std::cout a hex value to the console but it kept evaluating the hex to decimal (Understandable). So, I remembered not knowing...
[1 reply] : If you want hex, do this std::cout << std::hex << std::showbase << 0... (by salem c)
How can I read file at certain path?
 
[Closed by author]
[6 replies] Last: Well, I am not actually making anything for windows. I am making a 3ds... (by SirEnder125)
C++ Program to display Information about Medical personal
 
Having a difficult time writing a code to display the information on medical personal, this is what i have so far. ]#pragma once #include<string> using n...
[13 replies] Last: So fix it. You declared a bunch of functions but failed to implement t... (by jlb)
Djikstra Algo Ouput Problem
 
Hi, I am currently doing a project on Graphs and its almost complete. Whenever i enter a char other than A it gives me errors. I still can't figure out what ca...
[1 reply] : You can simplify some of the code: void printPath(int parent , int ... (by seeplus)
tellg() and get()
 
I have written a simple algorithm to read a text file backwards: int main() { ifstream file("myfile.txt"); if(!file.is_open()) { cerr <<...
[2 replies] Last: get() reads and moves the file position This is exactly what I want... (by gedamial)
by JeanzZ
New to c++ problem with small bit of code im working on
 
Trying to get this code to work but having no luck.Thank if anyone can show what i need to do. #include <string> #include <iostream> #include <vector> #includ...
[2 replies] Last: This will now compile, read the data file and display it's contents: ... (by seeplus)
Help with Using string class member functions please
 
Hi here's my task an below is most of the code already done. Thanks for any guidance: Develop the program further so that it finds and extracts specified i...
[2 replies] Last: .find() returns the position of the beginning of the found string. Co... (by seeplus)
How to Implement classes?
 
Hi can you guide me on how to implement member functions of LimitedCounter, OverflowCounter and UseCounter in my code below? Here's the task: Derive a cl...
[2 replies] Last: It worked perfect. Thanks! (by closed account j3wpz8AR)
Meaning of Arguments in Main Function
 
Hi, I have a question about a main function with the following arguments: int main(int argc, char *argv ) Let's say the above line comes from a source...
[2 replies] Last: https://www.gnu.org/software/libc/manual/html_node/Program-Arguments.h... (by keskiverto)
[BCC32 Error] pFIBScript.hpp(61): E2040 Declaration terminated incorrectly
 
Hi, I inherited a project in RadStudio 2007, which uses FIBScript version 1.8b2. Compiled FIBScript all files to work in C ++, everything is fine. I'm starting...
[1 reply] : show the code around line 61 of the offending file. its likely a ; p... (by jonnin)
const char[3] does not generate template parameter of char[3]!
 
The code: template<typename T1, typename T2> struct Pair1 { T1 first; T2 second; Pair1(const T1& x, const T2& y) : first{ x }, second{ y } {} }...
[8 replies] Last: ok so the compiler is not giving very clear diagnostics! Thanks @Cubbi... (by JUANDENT)
December 2020 Pages: 1234... 6
  Archived months: [nov2020] [jan2021]

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