General C++ Programming - March 2022 (Page 4)

Stuck on project
 
I have this project to do for my c++ class but I am struggling to get the program to read input from a file. This is my assignment: Write a program that declare...
[3 replies] Last: In addition to the comments by jonin and seeplus: save data in a fil... (by AbstractionAnon)
All about Structures
 
Hello. I'm studying deeply into the structures since I'm still having difficulties in structures. I have a question regarding the example structure code below. ...
[4 replies] Last: Another modern idea is to use a C++ container, like a std::vector, ins... (by George P)
VSCODE syntax error
 
I have a 3D printer that has firmwear to run mainboard. To tweak the firmware VSCODE is used, I believe C++ ? Im as green of C++ . Every time I compile. I get...
[3 replies] Last: https://docs.platformio.org/en/latest/projectconf/section_platformio.h... (by lastchance)
by Pen72
How to decrease time complexity
 
Given sequence A=(a1,a2...an) find Kth Smallest Element in iteration A[1,k],A[a,k+1]...A[1,n] For the Input Format, the first line is n and k, the second l...
[11 replies] Last: #include <iostream> #include <vector> #include <set> #include <functi... (by lastchance)
by gabbe
problem accessing base-class array
 
Hi! I have a program like the following one where the function checksum should be able to run on different classes derived by base . #include <cassert> st...
[3 replies] Last: That s exactly what I guessed! I decided to go for generic programming... (by gabbe)
View Record Problem
 
Hello. I have a problem with the code below. In the view records menu, after I input something in add records, instead of storing all the inputs that I have don...
[5 replies] Last: Perhaps consider: #include <iostream> #include <fstream> #include <... (by seeplus)
by stav
storing / accessing variadic template arguments passed via constructor
 
Say i have a class like this: class Parser { public: template<class... Args> Parser(Args&... args){} virtual ~Parser() = default; void Parse(){} ...
[1 reply] : Use a non-template: #include <initializer_list> #include <vector> #i... (by mbozzi)
Setw(); not outputting what I want with structures
 
For some reason I can't get setw() to separate each number correctly in my compareExpenses function on lines 65-81. I watched a youtube video of it showing how ...
[12 replies] Last: FWIW #include <iostream> #include <iomanip> // HEADER struct Monthly... (by againtry)
Char arrays, validating for no spaces
 
I'm trying to make a validation to not accept any spaces in the char array, my other validation works, but I'm not supposed to calculate the math or statistics ...
[13 replies] Last: @seepluse Ahhh! thank you! I guess I wasn't using my bool valid corre... (by jetm0t0)
by frek
Tools a C++ programmer may need (1,2,3)
 
What tools, apart from the IDE (which may be installed or online), the debugger within it and version control system like git do you use as a C++ programmer, pl...
[48 replies] Last: For instance we have a factorial algorithm and wish to test it using C... (by frek)
by SYX00
Matrix walking problem
 
I'm new to C++. I'm solving the "Matrix walking problem", but I can't find the law of this question.The problem goes like this: Given a pane of n*m cells, how ...
[11 replies] Last: Ok,thank you! (by SYX00)
Problem with class/array of object
 
Hello, I have been having a problem with a code that involves creating a flight booking system that stores a maximum of 10 flights, with each flight containing ...
[5 replies] Last: Thank you everyone, I was able to fix my code! (by spinach999)
Size keyword
 
So I just got help with a tutor and his program uses "size" in a lot of the loops. Unfortunately I can't get a hold of him, and I'm not sure how this program ac...
[4 replies] Last: Perhaps something like: #include <iostream> #include <string> cons... (by seeplus)
c++ trap
 
I'm a newbie to c++ but I have a background in python, but with that Said, I have run into a bit of a snag with my toying around with c++. Before I ask my quest...
[9 replies] Last: [quote=DizzyDon]@lastchance, You could put the ws in the getline inste... (by lastchance)
by frek
Find minimum distance
 
A non-empty array A consisting of N integers is given. Array A represents numbers on a tape. Any integer P, such that 0 < P < N, splits this tape into two non...
[3 replies] Last: How to measure the "correctness"? Well, just do your level best to "pr... (by lastchance)
by frek
Passing through a path step by step task
 
Task description A small frog wants to get to the other side of a river. The frog is initially located on one bank of the river (position 0) and wants to get t...
[no replies]
cv::Mat parameter compile error
 
I keep getting the following compile error for this: int size = { 4000, 7000, 2 }; // cv::Mat LUT(3, size, CV_64FC1, cv::Scalar(0)); error underlined =...
[16 replies] Last: I already did, a 1 dimensional table of data with some sort of accesso... (by jonnin)
Dynamical scope advantages
 
What are dynamical scope advantages in compilation, runtime and others low-level efficiencies respect? Would please get it clarified with the examples ?
[8 replies] Last: I might be okay but I'm not fine at all! (by Ganado)
converting a program from using syscalls to stdio library funcs
 
Attempted to switch from using syscalls(program1) to the stdio library(program2) But while I get bytes/sec and everything else in first program, second program ...
[4 replies] Last: Thanks kigar, I will try those options out! (by Volapiik)
by frek
Order of execution done by the compiler/implementation
 
Hi all, I know that the code snipped below is wrong based on C++ rules, but do you have something in mind resembling it to demonstrate the difference between t...
[6 replies] Last: I was referring in my post above really to evaluation order - but I di... (by seeplus)
March 2022 Pages: 1234567
  Archived months: [feb2022] [apr2022]

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