Beginners - January 2022 (Page 3)

Problem with stod function in C++
 
Hello, I'd like to convert the string to double. after convert, s is not the same of d. Could you please help me? https://ibb.co/fMD1LT2 Thanks #include ...
[2 replies] Last: after convert, s is not the same of d True. As expected. Round-trip... (by seeplus)
Operator overloading error for complex data
 
I wrote this code vector<complex<double>> y1,y2; //some stuff vector<complex<double>> W_N; //some other stuff vector<complex<double>> term1(N/2), term...
[15 replies] Last: @lastchance, could be. I'll try that later. Thank you everyone for yo... (by Rakib771)
Is there any way to add functions to std?
 
I have just been very curious as to how header files add functions or anything at all to std because i have tried all the following below but none of them work ...
[2 replies] Last: The standard library implementation does this: namespace std { void t... (by mbozzi)
file search
 
I need to take leftmost variable from last line of file. getIncrement.seekg( sizeof( ClientData )) gives me last line. How can i easily reach for leftmost var...
[3 replies] Last: I would be tempted to say to read one letter at a time backwards into ... (by jonnin)
Error with multiple template in operator overloading
 
Simply, I tried overloading '+' operator for vector container. When I do this, <template<class T> std::vector<T> operator+(const std::vector<T>& vec1, const ...
[5 replies] Last: We can use an expression template to hold the result of the + expressi... (by JLBorges)
how would i match get a word only if it is between 2 numbers using regex
 
how would I match get a word only if it is between 2 numbers using regex eg the input is: 5testword5,5testword5testword43 it matches testword;(so I can replace ...
[2 replies] Last: @dizzyDon only works for the first word, inputs such as 123hello123he... (by codinglexernewbie)
Simple login program will read from file but won't write to it.
 
I'm writing a simple login program that reads and writes info from a text file. The program will read from the file flawlessly but it can't seem to write to the...
[2 replies] Last: This will work better, thank you for the correction. (by pizzafreak1991)
Class Will Not Run
 
For an assignment, I'm supposed to create a class called piano and then use the methods: 1-) LoadNotes. This function takes a string as a parameter, the parame...
[14 replies] Last: ... furthermore, that code does not "test" class Piano. It is closer t... (by keskiverto)
system with variable
 
Hello! Need to take variable char or string data and make system call (Linux CLI) as per above. Please advise const char key = "echo -n '3. Current Direc...
[13 replies] Last: > I don't know how to convert linux commands to C++ functions. https:/... (by salem c)
Breaking down this class
 
It's been quite some time since I've lasted tackled a programming assignment, so forgive me for what might be dumb questions. So I'm trying to get a grasp on th...
[13 replies] Last: Actually there are several problems: /** * Returns the element of the... (by coder777)
What is the problem with 2d array in C++ code?
 
Hello, I wrote the below code and I ran the code in "Code Blocks" IDE. if I enter m = 2 and n = 3 , the program cannot get 6 element. I attached an image....
[4 replies] Last: https://stackoverflow.com/questions/936687/how-do-i-declare-a-2d-array... (by againtry)
genericity
 
Hello, I'm french so please forgive me if the vocabulary doesn't fit the English standard. I'm trying to make a generic class called Type with the help of te...
[5 replies] Last: a constructor does not create more objects. if it is not in the code,... (by jonnin)
by janac
Incrementing iterator using an integer
 
My question is: why can't I increment a list iterator using an integer? Here's the error, which says the + operator isn't defined for list iterator. "binar...
[9 replies] Last: Don't forget std::next() which can take a number of element positions ... (by seeplus)
by janac
Passing (?)constant iterators to function
 
I don't understand how to know the constant-ness of an iterator. Looking at the error message, it seems to say that the iterators returned by begin() and end() ...
[3 replies] Last: > are they constant references? Or is it that what they're pointing to... (by ne555)
Help: Invalid conversion error, MINGW
 
Hi, What is changed about thistiny func? This used to work earlier MINGW but now it hits an error. (MINGW version 10.x.x). The idea of the func is give access ...
[2 replies] Last: Hi, Thank you much. I try to compile it with MINGW. Let's see... (by JohnCage)
Establishing command keywords in an interpreter in C++
 
Hello, all. I'm kinda new here, working on a new little thing. I was curious as to the nature of command prompts and the like, mainly having coded in Python. As...
[10 replies] Last: Are you going to do lexical analysis to generate tokens and then synta... (by seeplus)
by Mif
How to modify numbers in file "C"
 
Hello.. I want to modify a file that contain numbers which are divided by ",". The numbers in file are represented like this: Example 000.0,001.4,003.2,012...
[8 replies] Last: I think I may have a mistake.. at the end of every line I forgot I don... (by Mif)
Print one line to multiple lines with \n or space or fixed length
 
Hello, I would like to ask for your help to review my code. As the title, I would like to print one line to multiple lines with special character as `\n` (AS...
[6 replies] Last: Thank you, guys. Those solutions work expected and perfect. (by seal2002)
Command line about descending numbers using input numbers
 
I want to make a program by using the command line to descending numbers with an input of five numbers or below on Visual studios 2019, if the input of numbers ...
[7 replies] Last: Oh. It's supposed to use command-line arguments for the program. Well ... (by seeplus)
Form expression to tree printer
 
I want to create a tree viewer from postfix expression and of course I'm stuck. First the code: #include <string> #include <stack> using namespace std; st...
[5 replies] Last: I guess it's just as easy to do it from the postfix form. #include <... (by DizzyDon)
January 2022 Pages: 123456
  Archived months: [dec2021] [feb2022]

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