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

by Cplusc
Adjacent Cell
 
I have a grid in which every cell build up of 3 nodes. I need to find the neighboring cell of every single cell in the grid. The point is if two cells share the...
[3 replies] Last: bool adjacent {}; then take the output of your slow code and shovel i... (by jonnin)
Directshow RenderStream returns E_INVALIDARG
 
I am working on a video capture program under windows that takes frames from the webcam and saves each frame as a bitmap. I followed the documentation on MSDN a...
[1 reply] : Maybe you should check if the Reads on L42 and L48 fail (i.e., add an ... (by DizzyDon)
Ensure "Shuffling" for Blackjack code
 
I have been giving an assignment to create a BlackJack program,and have been given some starter code to help us along, however I'm running into some problems tr...
[4 replies] Last: Ignoring the Windows-specific coding here's one possible way to ... (by George P)
by frek
Pointers, deletion and nullptr
 
If an allocation happens with the new operator we have to deallocate the allocated memory which happens with delete . What it means may not be clear complete...
[9 replies] Last: Yeah, that's right, thanks, that was probably a typo, since this as a ... (by frek)
Please help with my code
 
I have to create c style functions header file and then create a cpp file to use the functions this is my header file #ifndef CSTRING_H_INCLUDED #define ...
[3 replies] Last: Perhaps: size_t Strlen(const char* s) { const char* sc {s}; ... (by seeplus)
by BZKN
lvalue required as left operand of assignment in C++ class (1,2)
 
Hi. Can someone please point me where and why am I making the lvalue required as left operand of assignment error in the following code? #include <i...
[26 replies] Last: @seeplus: thanks for this additional code snippet. It's helpful...... ... (by BZKN)
Valgrind errors
 
Hello I am fairly new to coding in c++ and I had some question about the errors I have been getting on my code. So I have this code where I have to read in some...
[4 replies] Last: ==282== Address 0x5b80440 is 0 bytes inside a block of size 7 free'd... (by salem c)
by tonic
Why Hex? C++
 
Hello guys, I recently put an eye on some game projects/ server and client.. but when sending data?! why not sending normal txt? i mean some commands or othe...
[4 replies] Last: wow thank you guys 100 times (by tonic)
Understanding a program that organizes a 1D array
 
Aight so this is gonna be a long one because my professor is a rat bastard who gave us a program to modify but didn't document the code. Base code will be in se...
[11 replies] Last: I was thinking a custom compare to sort by even/odd then by value... (by jonnin)
Develop a C++ program to calculate salary based on working days for a week.
 
Can anyone try to complete the code below Yes. Will I? No. What's the requirement? What is the program design? What part(s) are you having difficulty with...
[1 reply] : It looks like you want someone to do the work for you, for free. The ... (by George P)
Help with writing Fuctions and driver program
 
I have a problem with creating a .h function program and a driver program to test the functions. this is the header file I created: #ifndef MYFUNCTIONS_H_I...
[6 replies] Last: Possibly: #include <iostream> #include <iomanip> template<typename ... (by seeplus)
by helios
Better fstream?
 
Does anyone know any portable file classes that expose more control over files than what <fstream> provides? For example, specifying a creation disposition when...
[5 replies] Last: Er, you can do all those FileMode things with standard iostreams as-is... (by Duthomhas)
by Cplusc
distributed matrix vector multiplication
 
Fist of all I apologize if the question is not purely programming. Let's say I'm working with 2 MPI processors and I'm supposed to do a matrix vector multiplica...
[9 replies] Last: @lastchance This is just a simple case, let's say two elements and 4 n... (by Cplusc)
function template has already been defined
 
Hi, I have template<typename T> have_sort test_sort(decltype(&T::sort), decltype(&T::sort)); template<typename T> have_range test_sort(decltype(&T::beg...
[5 replies] Last: yes Peter87 but that is another issue. For now lets not think about th... (by JUANDENT)
index of a found string element of a vector using find function
 
How can I find the position of an element in the vector I am searching the element in for?
[1 reply] : Perhaps something like: const auto itr {std::find(vect.begin(), vec... (by seeplus)
Check if string element is not an element of a vector of strings
 
How can I check if a string isn´t an element of a vector of strings. The idea is, if the current string isn´t an element of that vector, it should be added to...
[2 replies] Last: Something like: const auto itr {std::find(operations.begin(), opera... (by seeplus)
find function element at the end
 
If the element I am trying to find using the find function is at the end of a vector, from what I understood, is it true that there isn´t really a way for me t...
[3 replies] Last: is it true that there isn´t really a way for me to tell if I found i... (by AbstractionAnon)
by frek
Passing Cars
 
A non-empty array A consisting of N integers is given. The consecutive elements of array A represent consecutive cars on a road. Array A contains only 0s and/...
[3 replies] Last: We should've used > 1000'000'000 instead. :) thanks. (by frek)
by frek
Missing Integer
 
Write a function: int solution(vector<int> &A); that, given an array A of N integers, returns the smallest positive integer (greater than 0) that does not oc...
[17 replies] Last: There is a picture of access patterns on this page Thank you for tha... (by George P)
Calculate value of an element based on values of others elements of the same array
 
Say I have a temp array with 3 elements and I change the values of the first 2 elements using a for loop constantly. Is it possible to calculate a value with th...
[1 reply] : Within the loop that changes the values of the first 2 elements, the t... (by seeplus)
March 2022 Pages: 1234... 7
  Archived months: [feb2022] [apr2022]

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