General C++ Programming - March 2021

Assert expressions
 
C/C++ Forum Each of my Vensim simulation modelling applications has a considerable number of C subprograms. These support the models. Each application also h...
[3 replies] Last: I see lots of bad use of assert() https://en.cppreference.com/w/cpp/e... (by salem c)
Need to remove rows with duplicate values in single column and older datestamp (1,2)
 
Hi I need to remove the rows with duplicate values in single column and older timestamp. I have an unsorted set of data that is stored in CSV file. I need...
[25 replies] Last: Create a counter for each each value of order_number that you find, an... (by MikeyBoy)
C++ call stack Problem 2
 
Implement the following function: int max(int a, int b, int c); Your program receives 3 numbers and prints out the maximum number // (Question) ( What...
[3 replies] Last: > Implement the following function: > int max(int a, int b, int c); It... (by salem c)
by int321
confusion leap year problem
 
This is what my problem is asking "Write a program that takes in a year as input (as a command line argument) and returns the string "{year} was a leap year'' i...
[4 replies] Last: thank you for your help, I realized I did the problem correct at the b... (by int321)
can't deference out of range vector iterator
 
Mistake: can't deference out of range vector iterator. file1.cpp using namespace std::chrono; int RandomNumber2() { return (std::rand() % 100); } void exper...
[3 replies] Last: You are going way outside the bounds of your array. Yes, thanks... (by onetwo12)
What is the good way in this string processing?
 
Hi. When you need to split the following string and store in struct, what would be your way to split it? // string example // This string is from a text file....
[8 replies] Last: Thank you guys! It helped me a lot! (by woohyeon)
Total price won't calculated
 
I developed a food menu program about selling sandwich. I don't have any error after compiling the code and the output is normal. But the problem is the total p...
[3 replies] Last: calPrice() needs to return a double, not an int. (by dhayden)
by Pepito
How do you pass the value that was inputted after each while-loop iteration?
 
Heya, I'm still quite inexperienced with programming since I'm just a freshman here, I just wanna know if there is a way to pass values that was inputted witihn...
[5 replies] Last: Line 9: Why is this called loop()? It doesn't loop. A better name i... (by AbstractionAnon)
by akeilo
Needing help reading characters from a .txt file
 
For an assignment I am needing to read characters from a text file and they are set up like this: ACTCACGCATCGACGT. I am supposed to read the file, output an er...
[2 replies] Last: #include <iostream> #include <fstream> #include <sstream> #include <s... (by lastchance)
by VDNS
Simple chained lists
 
Please help me with these 2 problems. :) 1. In the file "list.txt" there is a string of whole numbers all written on one line, separated by spaces (it is not kn...
[1 reply] : Please note that this is not a homework site. We won't do your homewor... (by keskiverto)
by Zenzei
Can help Me make a simple Leaderboard?
 
Okay. so I need help sorting the players. In my server functions can happen in if (btn == "buttonname"){ //function } I have a leaderboard menu made th...
[1 reply] : >Can someone make this for me? No, but we can help if you make a start... (by salem c)
Library with high perfomance low length integers (e.g. int4_t, int3_t)
 
Are there any libraries that support low range integer and have high performance I am particularly interested in being able to easily create packed low lengt...
[13 replies] Last: How do you store bitfields in arrays For example, struct Foo{ i... (by helios)
Working with comporator
 
I have a sorting. How can I do it with Comparator? Example of code: bool myfunction (int i,int j) { return (i<j); } template <class RandomIterator, class Co...
[3 replies] Last: No, it would be more like if ( comp(a , a ) ) { (by lastchance)
by JRManx
reinterpret_cast error
 
I'm experimenting with some binary files lately. Oh, I hear you out there: "Binary files...wtf?" But I'm trying to create a sort of database, and I'm getting th...
[10 replies] Last: helios, Oh! Ok, that makes sense. Will what I did work as well, or d... (by JRManx)
Bases of a number
 
we have a number n. We have to calculate the the number in all the bases to n-1 so for example if we have 5, we need base 2, 3 and 4 and also we need to calc...
[7 replies] Last: If n only goes up to 62 ... where would you use the lower-case digits ... (by lastchance)
Using threads gives Segmentation fault
 
Hi, I am working with a program that simulates the Single Model particle procedure. I am following this: https://github.com/davidhowey/SLIDE. The issue happen...
[9 replies] Last: Hi coder777 I found my problem and I will document it here for future... (by jgonzalez2605)
Read the data of the last employee
 
Hi, I'm trying to obtain the data for the last employee Bob Hu. But for some reason, it doesn’t want to show up. Does anyone know what I'm doing wrong? This ...
[5 replies] Last: The code basically says: while (getline()) { if (current name != p... (by dhayden)
Error Message
 
How do I put an error message to this? like for example: you accidentally pressed a letter intead of a number in grades then an error message will show #...
[7 replies] Last: I agree, just a shame that the shell only supports C++14 (by thmm)
No still looping
 
I'm learning c++ at my university. the problem is it is a "Try Another Y/N" but, whenever I chose option No the program still loops. What seems to be the proble...
[4 replies] Last: Something like (not tried): int main() { for (bool done {}; !done;... (by seeplus)
March 2021 Pages: 123... 7
  Archived months: [feb2021] [apr2021]

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