General C++ Programming - July 2021 (Page 5)

by Cplusc
switch in c++
 
I have a class which takes three arguments, number of row, column and value. I need to modify the vale during runtime and I'm using switch for that. but I get t...
[6 replies] Last: Thanks (by Cplusc)
by Annaer
Pseudocode implementation of forward search algorithm
 
Can anyone help me solve the problem of how to implement this pseudocode in C or C ++?I thought about it for a long time but didn’t succeed. ForwardSearch...
[2 replies] Last: This is a very general expression of the algorithm. Can you give some ... (by dhayden)
XOR Paths
 
You are given the following: A tree T consisting of n nodes An integer x Each node has some value w associated with it. Task Determine the number of s...
[3 replies] Last: @cool123dude, Show your input format and your attempt. You can do it ... (by lastchance)
referncing an int using boost
 
im introducing boost in my code and would like to make the datapushback that occurs on line 110 to pushback the int "points" instead of "1, 2", id also like for...
[7 replies] Last: You haven't shown the error message, so can't tell you. (by AbstractionAnon)
Reading Binary Files
 
I have this code but it's failing one test with using option 3 to read both files because it's only reading one and I'm not sure how to fix it. #include <ios...
[2 replies] Last: Can you provide the input file? Use C++ strings and vectors instead o... (by dhayden)
Read file by column
 
Hello, I just learned c++. I have a data with 4 rows and 3 column 2019 2 15 2018 3 23 2017 4 09 I need to read this file by column. I know how to read...
[7 replies] Last: Yes - assuming that smallest is set to some initial high value that wo... (by seeplus)
excpetion unhandled using boost
 
i dont know what is going wrong and I am beginning to panic. trying to learn serialization with boost. accidentally deleted the file "scores.txt" that I create...
[9 replies] Last: im not sure what ive done but its fixed (by JackLadYT)
by Cplusc
c++ class
 
I define a class for generating matrix and there is no bug there but when in main program I want to see the matrix output it shows me nothing, I am not attachin...
[4 replies] Last: L10 Pass matrix by const ref and not by value. This is currently doing... (by seeplus)
enable_shared_from_this initializes an empty weak ptr so how does it work its magic?
 
enable_shared_from_this creates a shared_ptr from an empty weak ptr. This makes no sense to me - I would have thought that the weak ptr should be initialized wi...
[6 replies] Last: Thank you so much!! Both @mbozzi and @JLBorges!! It is clear now (by JUANDENT)
help with Vector class question
 
Please help me answer this question. Given the following class declaration of a Vector class, which works similar to those in math and includes a multiplicat...
[3 replies] Last: Perhaps: #include <initializer_list> #include <algorithm> #include ... (by seeplus)
by Cplusc
default constructor does not exist in the class
 
anybody can help with this piece of code; I am using class to build matrices nut when I define my object it says the default constructor does not exist. how ca...
[12 replies] Last: Admittedly the const version is a bit silly without a way to initializ... (by Ganado)
by eri0o
for(int i; i<length; i++) performance
 
Hi, I have been looking some codebases that use SIMD intrinsics and other technics to get better results at doing things. It got me thinking recently... Ther...
[7 replies] Last: It's been shown in articles by cppstories that simply replacing std::a... (by seeplus)
by Cplusc
Class in c++
 
hello everyone, I am working on finite element and I have two text files which one of them is the element connectivity and the other one is the mesh coordinate....
[12 replies] Last: Thanks (by Cplusc)
How is this inheritance used and produced
 
//Band.CPP #include "Band.hpp" Band::Band(int members, int foundingYear):members(members), founding_year(foundingYear){} Band::Band(int members){ ...
[1 reply] : I believe you've already been asked to use code tags around your code.... (by kbw)
Why does emplacement allow you to discard const
 
Why does the following compile? class Fred { public: Fred(int value): i(value) { } Fred(Fred const&) = delete; Fred con...
[5 replies] Last: This blog talks about your const return type, and pretty much says it ... (by kbw)
Constructors/Assignment operators for class with int pointer
 
Hello! This is my current code: #include <iostream> #include <string> #include <vector> #include <fstream> #include <filesystem> namespace fs = std::...
[12 replies] Last: Those are just reorder warnings telling you that your data members wi... (by seeplus)
by vboro
Capitalize given part of string?
 
Hi everyone! I have a program, where I receive a text from the user. In this string, there are parts between quotation marks, as well. My task is to capitali...
[4 replies] Last: #include <iostream> #include <string> #include <cctype> using namespa... (by lastchance)
How to write the main function
 
//FuelFlowSensor.hpp #include<iostream> using namespace std; class FuelFlowSensor{ public: FuelFlowSensor(int time, int flow); FuelFlowSensor(); in...
[3 replies] Last: @OP Here's a practical start. You will need to complete the class impl... (by againtry)
July 2021 Pages: 1... 345
  Archived months: [jun2021] [aug2021]

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