General C++ Programming - December 2020 (Page 5)

numeric variable used in array name
 
I have built a 20 X 20 neopixel display using 400 WS2812B LEDs. This will be controlled by an Arduino Mega using their version of C++. I have also created a n...
[7 replies] Last: You need to distinguish between texture coordinates and screen coordin... (by mbozzi)
When is delete keyword necessary?
 
[Closed by author]
[13 replies] Last: Yes, helios, very much a recurring pattern. You were just the latest.... (by deleted account xyzzy)
C++ Raycaster using SFML
 
Greetings, I know this isn't exactly C++ related, however, I was just wondering if anyone knew anything about texture mapping onto a raycaster. I'm currently t...
[no replies]
C2011 'timespec': 'struct' type redefinition error.
 
I have the following code and when I try to compiled it I get a C2011 'timespec': 'struct' type redefinition error. Can someone please tell me what is my error,...
[2 replies] Last: Works for me (gcc / Ubuntu). $ gcc main.c -pthread $ ./a.out 1000 Su... (by salem c)
by Rxlr
How to access information on an Object the user will create.
 
So, I've been struggling with how to do this for a while now. I have this function, which the user uses to let the program know how many Territories he wants t...
[1 reply] : Have you learned about scopes yet? http://www.cplusplus.com/doc/tutori... (by AbstractionAnon)
To release memory of a vla array
 
How to deallocate and/or release memory of a vla array ?
[1 reply] : There are no variable length arrays in standard C++. We have std::vec... (by JLBorges)
I need help with a two-dimensional table
 
Its given the matrix T with integer elements. It is considered that the two diagonals i divide the matrix into four areas: north, south, east, west (the eleme...
[9 replies] Last: @seeplus can you explain how you did the first program? (by blaster123)
by Amuiz
Passing an argument into the constructor of an array of objects
 
class Player{ public: Player(int NumberOfStats){ NumOfStats=NumberOfStats; } private: int NumOfStats; }; int main (){ int x,y; strin...
[3 replies] Last: For example, std::vector<Player> players; players.emplace_back(5); /... (by helios)
use a class in multiple others
 
I'm rewriting some STM32 C code to C++ and stumbled upon an issue. I used to have a delay(x) function, which obviously offered a delay. This was used all over ...
[5 replies] Last: Thank you everyone for all your replies. I guess the most relevant rep... (by banthong)
Beginner Level Linked List Qs
 
Codes are included, and I only have specific questions about lines of code below, please kindly help if you know what's going on: Node *link // is this sayin...
[2 replies] Last: Thank you Jonnin. I learned a LOT from you. (by junweinehc)
Variable doesn't update with Pointer
 
Hi, I've created a code which calculates simple geometries of shapes, e.g. area, volume. A user is intended to feed in a number (in the main.cpp file). While...
[4 replies] Last: I'm curious now about why your using const. Const correctness is b... (by keskiverto)
How to check if one string is the first half of another string? (Visit for explanation)
 
Hello. I was trying to make a function that checks if a string contains another string and if the other string is the first part of that string. For...
[4 replies] Last: Thank you all. :) (by SirEnder125)
i got no suitable convertion right her "std::istream_iterator"<std::string>(std::istringstream(nb))
 
const std::string nb = "eight one six eight three three eight five four two nine six nine"; std::transform(std::istream_iterator<std::string>(std::istringstrea...
[2 replies] Last: thank you mbozzi it works and great reason explanation (by aymanawa)
Program skipping first line of input when displaying final output?
 
Hi all! So I have put together my code for an assignment for a C++ class that I am in when I came into a little of a hurdle. So my code takes the input perfe...
[7 replies] Last: For easy compile, I moved the .h contents into the .cpp file OK, but... (by Peter87)
Can somebody help me with my code please??? Thanks
 
Hi, I wrote the code for the Classes but can I have some guidance to do the following, please? Write a program that defines a vector of shared pointers to the...
[3 replies] Last: Circle(double xcoord = 0.0, double ycoord = 0.0, float r0 = 0.0) : P... (by seeplus)
+=operator
 
hello I have the following question: modify the +=operator so it can add an element to the vector of distances the number of stops will also be incremented ...
[7 replies] Last: Decomposition and encapsulation . The operator+= decomposes into t... (by keskiverto)
by Ocko91
calendar
 
Hello , can someone PLS check my code and tell me how to fix it ? I hope i i formated ift well... dateType.h #ifndef dateType_H #define dateType_H #include <...
[4 replies] Last: Thank you seeplus ! salem c i am using visual basic 2015 on windows ... (by Ocko91)
Help with bool>operator
 
the question is change the operator overload < it will return true if the total distance of the route represented by the first operand is smaller than the to...
[4 replies] Last: This appears to be related to http://www.cplusplus.com/forum/general/2... (by dhayden)
Swapping array elements
 
Is there a way to swap an element into an array at a specific point. For example i have a string array of {"cat", "dog", "fish"} and i want to swap out "dog" wi...
[3 replies] Last: "swap" as you are using it, you are saying 'replace' which is valid i... (by jonnin)
constructor
 
hi i had for this exercise to make a copy constructor, a destructor and =operator class TrainRoute { private: string departure; string destination; ...
[2 replies] Last: Assuming that the copy constructor is OK then the operator= can be imp... (by seeplus)
December 2020 Pages: 1... 3456
  Archived months: [nov2020] [jan2021]

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