General C++ Programming - March 2018 (Page 3)

2D array issue
 
This is to calculate how much 3 monkeys eat in a week. it generates the total amount eaten by all the monkeys, the least amount eaten by a monkey and the most ...
[9 replies] Last: Yeah, I didn't know there was a way to set the minimum to the highest ... (by daveconn66)
comparing strings
 
Write your question here. How can I compare these two strings and count when the strings are the same? It prints 10 all the time Put the code you need help ...
[6 replies] Last: Thank you for your replies. I have figured out the source code, appare... (by codes4life)
Any O(log n) find time complexity datastructure that is not a map?
 
Any O(log n) find time complexity datastructure that is not a map.
[5 replies] Last: How often do you need to add or remove elements from the data structur... (by helios)
std::for_each
 
Hello, Is std::for_each faster than c++ for and in a for_each statement how can I determine the current value of the iterator and the value of the vector fr...
[1 reply] : Did you look at: http://www.cplusplus.com/reference/algorithm/for_each... (by keskiverto)
Interesting bug with the pow() function
 
I tried running the pow function to generate large numbers and I get some weird results. At first I thought it was an overflow issue so I cut it back a little, ...
[7 replies] Last: Or, don't use doubles ... the program is looking for integer powers, a... (by jonnin)
by ayokng
qualified name is not allowed @hash::NumberOfItemsIndex
 
Solved by putting everything in one class. Best solution I could think of hope it helps someone I keep getting an error saying qualified name is not allowed...
[2 replies] Last: Yeah it was a typo Hmm the issue is with GUI version I'm making. it w... (by ayokng)
using template to pass aditional argument
 
I need to pass a (function with one argument) as an argument to another function, this another function is fixed - can not be changed becasuse it is already w...
[6 replies] Last: 1. In arduino environment IDE appernetly there shoulnd not be a line b... (by mcf3lmnfs)
Bug in std::streambuf::in_avail ??
 
The following code: std::stringstream test; std::streamsize dataSize; test << ""; dataSize = test.rdbuf()->in_avail(); cout << "Available cha...
[6 replies] Last: if a stream has data, but the data is not buffered in an object (gptr... (by Cubbi)
Compiling C++, Visual Studio vs. Code::Blocks output
 
I personally like the information VS 2017 Community outputs when compiling a simple C++ program: #include <map> #include <string> template<typename KeyT...
[no replies]
by nsi
Create Big Multi-d Array w/o Causing Memory Issue
 
Dear C++ programmers! I have been trying to create a big multi-d array but each and every time there appears memory issues. Here is what I have tried. (1)...
[6 replies] Last: There is nothing wrong with visual studio. I have used it on large pr... (by jonnin)
Velocity Program not working
 
I can't seem to get this program to work. Every time I compile it, it gives me "The velocity is 78321 cm/s" #include <iostream> #include <iomanip> us...
[2 replies] Last: Thank you so much. :) (by Carrie Aeris)
Help reading the file
 
This is the text I have: Princeton University NJ Princeton 41820 8014 0.0740 0.98 0.97 Harvard University MA Cambridge 43838 19882 0.0580 0.97 0.97 Yale Unive...
[3 replies] Last: After you read "temp", you still have the \n remaining in the buffer. ... (by doug4)
NIM Game
 
sorry I removed the code because the instructor of the class I am in wanted me too.
[4 replies] Last: OMG!!!!!!!!! it was one semicolon!!!!!!!!! Thank you very much! I r... (by daveconn66)
Mandlebrot set zoomer...
 
Text mode nostalgia. What should I do with it next? #define LOOPS 1000 #define ESC 27 #define XSIZE 128 #define YSIZE 40 #define DELAY 1000 #defi...
[no replies]
Comparing lists of strings
 
I need to count the number of strings that occur in the first list, but not the second list. This is what i have // pre: A and B are sorted. // post: The...
[6 replies] Last: From file. Disallowing (or assuming no) repeats. #include <iostream> ... (by lastchance)
by noel3
Crazy IDE Pointer programs problem
 
When I create a program with pointers...then close and create a second program...then compile and run the NEW program, instead the OLD program runs that I close...
[5 replies] Last: A good and free Windows IDE is Visual Studio 2017 Community. A good c... (by closed account E0p9LyTq)
boost date-time conversion error
 
date dt{2018, 5, 14}; string str = to_simple_string(dt); cout << str << endl; error : undefined reference to `boost::gregorian::greg_month::as_short_stri...
[1 reply] : "Undefined reference" means that when the linker went looking for the ... (by Repeater)
How can I take an input from a 2D array into a vector
 
Hi, I have an an array of integers lets say: 1 2 3 4 5 6 I want to take the input from this array into a vector of vectors say: vector<vector<int> > ...
[3 replies] Last: Exactly the same way you have the 1D row vector. Three numbers is thre... (by keskiverto)
How can I find if a type is an instantiation of a certain template, like say set?
 
Hi, Now that we have constexpr if, can we find if a type is the specialization of a certain template (say: std::set<int> s; // or std::vector<int> s...
[2 replies] Last: Thanks!! Juan (by JUAN DENT)
Can anyone explain this BUG and how to fix it?!
 
So,if you were to run the program, after entering the file name again after the file had been created... before the menu is shown it seems to display my create ...
[5 replies] Last: Sorry, yeah that was comment... just ignore that haha (by ggrules)
March 2018 Pages: 12345... 15
  Archived months: [feb2018] [apr2018]

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