Beginners - July 2021 (Page 2)

Loop with multiple input to single output
I have to condense this list of 20 inFile.txt files to 1 output file. How do I do that? #include <iostream> #include <fstream> #include <string> #incl...
[6 replies] Last: L46. There is no loop termination other than failing to open a file. H... (by seeplus)
knight moves: How to print the path
Hello Everyone: I am working on the knight moves problem and managed to print the number of moves but still need to print the path e.g. "3 moves: path is: [3...
[2 replies] Last: Thank you for the help. will try to follow your approach . (by jaymann)
using namespace std
Hi everyone, I just noticed that (apparently) evrybody prefers to specify in the code the namespace of functions like `std::cout`. I'm wandering why. Is it any ...
[7 replies] Last: I avoid easily preventable problems by never having using directives a... (by George P)
Printing PDF to paper from command line and get print job ID
I need to make a command line program that can be passed a path and it will silently print the PDF without any prompts and will return the job ID for the print ...
[5 replies] Last: Hmm. There is a shell option to print non-text with right click, but ... (by jonnin)
by L67GS
Display vector contents
When displaying the contents of a vector is there a reason why print Works and cout does not work? This works: print(VectorName); This makes gcc ve...
[8 replies] Last: > I was intending to suggest in general that an equality test shouldn... (by JLBorges)
Library files for electronic components
Hi, I am new here and I am looking for guidance, not the code itself. I am an embedded engineer, and worked on electronics and c# a lot. We have a soft...
[1 reply] : > So, my question is, do I need to design that DLL file in C++ or we c... (by JLBorges)
Need C++ implementation of KMP algorithm
I am looking for a simple C++ implementation of KMP (Knuth-Morris-Pratt) algorithm. I was able to understand the concept from this article
[1 reply] : Duck found this very simple implementation; (test it thoroughly before... (by JLBorges)
How to extract only the data I required from different lines within a text file?
Here is the problem: I was asked to extract some data from a text file and insert them into a structure Like this: employee.txt Emp Id = 1290229 Name = Luke...
[15 replies] Last: Andy: Thanks for the correction once again seeplus: your concept... (by ThisAintMeDude)
Function being called without declaration
New to c++ and tried writing a login program. When running, you need to answer login or register to choose to make or to login to an account. Though for some re...
[12 replies] Last: Your functions called logFunction() and regFunction() are of type bool... (by Manga)
C++ function to Interpolate 2D Scattered Data on to 2D grid
I am looking for a C++ program/function for Interpolation for 2-D gridded data in meshgrid format similar to interp2(X,Y,V,Xq,Yq) in Matlab or scipy.interpolate...
[4 replies] Last: C++ does not have a built in one, you can find a library or, since thi... (by jonnin)
How to send data to file
i have a quaetion regarding file in c++. if i want to send a data to file , i will do cout << " Year : " << year << endl; toFile << " Year : " << year ...
[9 replies] Last: Hello kseokjk, To go along with what seeplus said a complete progra... (by Handy Andy)
Class destructors, and when to use them
1. Different sites seem to say different things about when a destructor should be created. I've read it's only necessary when you explicitly use the "new" keyw...
[3 replies] Last: > Say I write an app that has a class, and I don't write a destructor,... (by JLBorges)
How allow the graph to be either weighted or unweighted and either directed or undirected?
I have code for an adjacency matrix which is use to represent a graph. How would I get this code to allow the graph to be either weighted or unweighted and eith...
[2 replies] Last: Okay that helps. Thank you @ne555. (by Lacy9265)
Represent a graph using adjacent list
Write a C++ class derived from GraphInterface file. Use an adjacent list to represent the graph I have already done this with an adjacent matrix but now I need ...
[12 replies] Last: So you don't know if the code you written is considered an adjacency l... (by Lacy9265)
by vboro
Getline skipping third line?
Hi! I have a task where I must get the data from a simple .txt file. It works perfectly until the third line must be used. It's a program where I must co...
[2 replies] Last: Hello vboro, It works perfectly until the third line must be used. ... (by Handy Andy)
Splitting code into separate files
Hello I've just started using c++ so I'm learning as I go and doing lots of web searches. I'm trying to split my code into separate files as it's gotten quite ...
[3 replies] Last: Pass by reference . See (by keskiverto)
Compiler error: no matching member function for call to 'assign'
Hi everyone, I got the following compile error msgs and I cannot locate which code triggered this. Can someone help me to interpret the compilation message? ...
[5 replies] Last: thanks for all the replies. due to the size of the project, I cannot ... (by chuuuing)
Trying to get my bearings with *pointers and &references, and how they work together
New member, and new to C++! 1. Do pointers always point to a reference? int b = 1; int *a = &b; vs int b = 1; int *a = b; 2. If any, what is the func...
[3 replies] Last: int b = 1; int *a = b; this is a subtle error. if it works (it should... (by jonnin)
Hours keep coming up as zero.
#include <iostream> #include <iomanip> using namespace std; PROTOTYPES: void getPackage(char); bool validPackage(char); void getHours(int); bool validHours(...
[4 replies] Last: Hello agirideep, I do have some suggestions, but am stuck not knowing... (by Handy Andy)
Is it possible to use array in a loop as condition?
Is it possible to use an array as condition in a loop? For example in while loop? For instance: I want while loop recur unless index in array = {'G'}. wh...
[7 replies] Last: When you enclosed 'G' in brackets in the while statement Visual Studio... (by George P)
July 2021 Pages: 1234... 7
  Archived months: [jun2021] [aug2021]

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