General C++ Programming - March 2020 (Page 2)

References and Reverse Iteration over map
 
Hullo, I had a simple question. I surfed through the internet and came upon this solution for reverse iterating a map: for (auto it = map.rbegin(); it != map...
[2 replies] Last: Thanks for the clarification! (by hassanAman)
C++ where to begin?
 
I have a fairly involved question about how to start writing a c++ program, I know how to use different things in c++ but I don't know how to put it all togethe...
[9 replies] Last: well, what I was trying to say was, for substring searching you want t... (by jonnin)
file input and output
 
hello i am working on demonstrating input and output of files. I am getting an error prompt when attempting to run the attached code, without it showing any err...
[1 reply] : I am getting an error prompt And the error prompt is? We can't see ... (by deleted account xyzzy)
function advice
 
Hey everyone, So I made a 2d array. I have to find the lowest, highest, and average. Which I got that, but didn't really did it efficient in my opinion. I d...
[2 replies] Last: Efficiency aside, why is the array 2D if the dimensions of the array a... (by Ganado)
strings hashing
 
I am trying to check a substring if it's exist in another string using string hashing. This is my code. #include <bits/stdc++.h> #define m 1000000007 #defi...
[4 replies] Last: learner2 Maybe :) thank you (by ahmad alghadban)
Output all prime numbers between 1 and 100
 
Hi there, I just got and assignment asking me to write a program that outputs all the prime numbers between 1 and 100. The only main requirement is that I have ...
[8 replies] Last: Ah okay. I forgot that 1 isn't actually a prime number. As for changin... (by rainyday)
by Utku
SFML my move function is not working correctly
 
In my SFML application, my own move function does not work properly. If I write the move function's code directly to the main function, it works correctly. My ...
[2 replies] Last: @coder777 Thank you for your reply. I change my function according to ... (by Utku)
add each line from a text file into a vector
 
ok so basically i have a .txt file which is formatted like this thing1 thing2 thing3 thing4 etc. and i have a vector. i want to take every line of t...
[1 reply] : Line 6: Do not loop on (! stream.eof()) or (stream.good()). This does ... (by AbstractionAnon)
Checking for duplicate values in 2D array
 
Hi, I need help on checking duplicate values on a user input 2D array. I have this code so far and I am stuck on how to move on forward. What I want it to do:...
[4 replies] Last: for the approach I said, if you defined suits 0-3 and cards 1-13 (ace,... (by jonnin)
OpenToonz
 
Almost four years have passed since the PVS-Studio team checked the OpenToonz source code. This project is a very powerful tool for creating two-dimensional ani...
[1 reply] : The slow gradual slide into off-topic-spammery continues. Post it in t... (by salem c)
by Sid321
Arrays and Function Overloading Sort
 
I have no idea where to start with this one?!!! 1. Create a main function in a main.cpp file. The main function should look as follows int main() {return 0;...
[2 replies] Last: Technically, in the instructions #2 and #3 are the same thing. To go ... (by doug4)
by NadH
Call to a C++ Dll function : SLOW
 
Hi, I have created a function F1 in a C++ DLL among many other functions. When executed simply from another C++ program, F1 runs normally with logical dur...
[16 replies] Last: I will try a few stuff as you suggested and get back asap. Thank you a... (by NadH)
by DeeMoo
How to create a file with imputed file name?
 
I need to create a file with custom file name. Person has to imput the files name and then it is checked if it exists or not. After that it gives a response. T...
[2 replies] Last: Thank you very much :) (by DeeMoo)
sprintf format for date::year_month_day
 
I'm getting this warning on my program : ``` OC/HelpOC.cpp:711:43: warning: format '%d' expects argument of type 'int', but argument 3 has type 'date::year_...
[3 replies] Last: You can tell the compiler to stop complaining by casting that value to... (by kbw)
Need Help
 
In my project, I am taking the surface area and turning that into dollars and cents. For example Total surface area to be painted: 74691.87095 square inches...
[2 replies] Last: Try say int cents = Area / 10; int dollars = cents / 100; cents = cent... (by salem c)
Horizontal Histogram
 
Hi all,    I am writing a program which takes in an ArrayList of numbers to create a horizontal histogram of the numbers' frequency. The first two numbers typ...
[2 replies] Last: Oh, I didn't catch that! Thank you, I will update that and check my ar... (by kitcats)
Deficient, Perfect, Abundant
 
Hi there, my professor just assigned us a new assignment to write a algorithm that determines whether or not a number is deficient, perfect or abundant. A numbe...
[11 replies] Last: Good job! You can make this even better by simply moving the declarat... (by dhayden)
by Iamme1
Resource file
 
I need help on a simple program. I wrote a program that solves the mean and variance of some amount of float numbers. I want to try new thing making the main pr...
[1 reply] : #include <fstream> //to work with files int main(){ std::ifstream... (by ne555)
Try to set a while statement with a loop and a break
 
#include <iostream> #include <iomanip> #include <Windows.h> using namespace std; int main() { double hrsWorked = 0.0; double rate = 0.0; double overtime = ...
[1 reply] : Is there a question? (by helios)
Executing Dynamic Objects Member Functions - But they don't exist yet
 
Hello. First of all, I just want to say, thank you for taking the time to read this. I've been having a hard time figuring this particular thing out, and I ha...
[5 replies] Last: use vectors. your pointer = null and memory later is fine. but vect... (by jonnin)
March 2020 Pages: 1234... 7
  Archived months: [feb2020] [apr2020]

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