General C++ Programming - July 2022

by Geckoo
Computation using GPU instead of CPU
 
Hello. I have a little question about computation using a classical computer. As you know I developed a little 2d engine in order to play with pixels, mathemati...
[4 replies] Last: CUDA is Nvidia-specific and, to the best of my knowledge, works with... (by kigar64551)
Replacement for global variables
 
So, my professor assigned this project where we cannot use global variables. (I DO NOT HAVE ENOUGH SPACE TO FIT CODE IN THIS POST, SO I WILL ATTACH IT AS A REP...
[9 replies] Last: Maybe something like: #include <iostream> #include <iomanip> using... (by seeplus)
by Runsva
Function Pointer using "typedef" keyword with Function Address stored as Variable? (C++ 14, VS 2019)
 
---- Problem Summary ---- I'm attempting to create a callable function pointer inside of a function using templates for its return value and its arguments us...
[6 replies] Last: On mainstream implementations, (on any POSIX compatible system) a fu... (by JLBorges)
by PeteDD
pass header name (withoug .h) in class constructor ... and #include
 
My head is wrapped around the axle once again... I am designing a system where I need to pass the name of a header file (a driver...) in a class constructor an...
[8 replies] Last: jonnin and mbozzi, Thanks for thinking about it. The point is clear ... (by PeteDD)
HELP on array and function project code.
 
This is for a project for one of my online classes and I don't understand why it isn't running. It comes up with the error code saying linker command failed...
[16 replies] Last: Dealing with the very-tight strait-jacket approach most C++ courses fo... (by George P)
Help with Files into Vector assignment
 
If you have not downloaded the Gaddis text book’s source code, you will find the following files from chapter 7 folder provided here... GirlNames.txt Do...
[2 replies] Last: What help is required? Can you open/read from a file OK? Can you use a... (by seeplus)
by frek
Max number of disc intersects
 
The task says: We draw N discs on a plane. The discs are numbered from 0 to N − 1. An array A of N non-negative integers, specifying the radiuses of the dis...
[7 replies] Last: On intersection, which of these do intersect? A = 1 A = 0 A = 1 A... (by lastchance)
Problem with Switch statement
 
I am having problem with this code where nothing shows up. It goes to the default statement displaying an error message. #include <iostream> #include <fstrea...
[1 reply] : See your other thread. (by salem c)
Assigning weights to blank spaces and displaying them
 
I am supposed to create a racing game where the player will start at the highest weighted number and the finish line will be the lowest weighted number(0). I am...
[3 replies] Last: When @Duthomhas says "use pythagorean theorem", he means use straight-... (by mbozzi)
by a456df
Blank Spaces assigned weights
 
Having trouble figuring out how make part of this game. I'm currently trying to assign value (weight) to blank spaces in a program. The values need to decrease ...
[6 replies] Last: Whoops, I did some extra work in the above: // Find the "minimum dis... (by mbozzi)
by oddy
A exception has been thrown when solving 8-digit problem
 
As the title, I am going to solve 8-digit problem using breadth first search (BFS), but it has thrown me a exception. Here is the output: terminate calle...
[5 replies] Last: no idea what that is Using your fingers to type, but not your thumbs... (by MikeyBoy)
The .cpp program does not see the GL/glew.h file.
 
In the directory where the program is located (C:\2022\Work\programming\engineering\my-works\my_game\programs), there is also the glew-2.1.0 folder, which conta...
[3 replies] Last: @Geckoo, thank you! (by VladTsyb)
by ruzip
Translate Scancode to Virtual KeyCode
 
Is there a way to easily translate scancode to vk code? I'm using GLut.. Say if the scancode is 30, it should trigger Letter A (upper or lower)
[1 reply] : https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-... (by George P)
Program Failing when trying to assign value to structure pointer
 
I'm creating a binary tree to guess an animal that a user is thinking of. The last problem I seem to have before the program is finished is involved with my tra...
[7 replies] Last: yes that solved it; the deletion of L68,69 and the insertion of the fo... (by whiteW0lf)
Is base class object created when a derived class object is created?
 
When i create an object of derived class, Does the base class object gets created too? Meaning there are 2 objects? Because i have to use base class constru...
[5 replies] Last: > Technically, there is just one object, containing the fields of the ... (by JLBorges)
Check if a vector contain duplicate numbers (1,2)
 
If a vector contain duplicate numbers, return true, otherwise return false. For example: nums = [1,2,3,1] true nums = [1,2,3,4] false My code: bool contai...
[22 replies] Last: PS. For the set method, the time taken is pretty much dependent upon t... (by seeplus)
by ruzip
Assert Implicit Declaration or Non-existent Functions
 
or functions that does not exists.. Is there a way to do an assert on C (particularly) so if a function does not exist (implicit declaration) AND undefined s...
[2 replies] Last: Thanks. I was also looking for an example using assert. (by ruzip)
by t im
Question about leetcode #209
 
The problem is to find a contigous subarray that is larger or equal to the given target(https://leetcode.com/problems/minimum-size-subarray-sum/). I have got th...
[3 replies] Last: I have figured it out. Thanks for your answer. (by t im)
Reading Integers with defined characters C++
 
I'm trying to parse a file that has has integers and strings in a CSV file. There in columns and rows and would like to read a integer and string in "" based on...
[2 replies] Last: I'm not sure what you want when you get an s? This code will display t... (by seeplus)
error C2039:string_view (1,2)
 
hello all, how can fixed this error error C2039: 'string_view' : is not a member of 'std' i use VS 2010 All solutions set to "/std:c++17" in langu...
[23 replies] Last: If you're a beginner, why are you copying relatively complicated code... (by kbw)
July 2022 Pages: 123
  Archived months: [jun2022] [aug2022]

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