General C++ Programming - December 2019 (Page 3)

C++ source code for built by Visual studio, in Mingw/msys
 
Would anyone generously guide or point out us the critical key points to successfully compile and build a C++ source code intended to be built and released perf...
[4 replies] Last: E.g. here's Windows 'zone' must be transfigure to Mingw/Msys: Notepad... (by MikeyBoy)
by obeeey
How to generate objects that don't overlap each other?
 
Hi, I'm using SDL 2.0 for my project to create retro Frogger prototype. This is what it looks like now: https://pasteboard.co/IMtCBnl.png The code for g...
[1 reply] : If two objects don't intersect then the first object must be above, be... (by dhayden)
Comparing two dimentional array with one dimensional array
 
#include <iostream> using namespace std; int main () { int student1mark = 0, student2mark = 0, student3mark = 0, student4mark = 0, student5mark = 0, stude...
[3 replies] Last: Thank you b0ss for your help (by GabeSonny21)
Threads
 
Moin zusammen! In der Konsole wird nur "foo" ausgegeben. Wieso wird beides nicht "parallel" ausgegeben? (Hab ein Mehrkernprozessor) Danke Co...
[6 replies] Last: Thanks (by minimi3)
Extracting specific data from text file (1,2)
 
Hi i have a file name LTS_IMSBR.txt and it includes the following data: User Physical Location ---------------------- Equipment ID = 172.22.5.74:29...
[23 replies] Last: Do you have fgrep on your system? $ cat x Subscriber number Terminati... (by dhayden)
by volang
Hyphens and dashes difference?
 
I have received a string from a client that looks like this: "----Code". When I search for "----Code", it doesn't result in a match. Only when I search for "Co...
[2 replies] Last: If the message is in unicode, there's tons of different dashes or hyph... (by Ganado)
by L404
modifiable lvalue
 
Hello I am trying to make 2 items inside of if statment for example I want to make this with define BEGIN POKEMON{ NAME:"PIKACHU" HP:100 } POKEMON{...
[9 replies] Last: The syntax looks very similar to JSON, is that what you're trying to e... (by Ganado)
Beginning of class array is always the same
 
I am working on a crazy eights game. I created a card class that has a Suit enum and a number for its value. I created a vector of the card types and put them...
[1 reply] : You are always trying to push back the card one beyond the end of the ... (by lastchance)
Segmentation Fault (Core dumped)
 
When I try to sort 1 million values, I get segmentation fault on following code. It works with <= 100 thousand values, so I am probably missing a small detail. ...
[6 replies] Last: Creating an array that does not have a const size at compile time is i... (by George P)
by obeeey
SDL 2.0 and SDL_Rect structure
 
Hello, I'm in the middle of trying to make a simple game. I wanted to make a structure, which would contain every SDL_Rect object that needs to be displayed so...
[2 replies] Last: I don't know why I thought about structures - arrays seems easier, tha... (by obeeey)
Sockets ( not receiving data )
 
Hi guys I seem to be able to get a connection between the server and client but when the server tries to print out the buffer it prints and empty buffer just s...
[2 replies] Last: also I now decided to send my message which is just hello in a loop s... (by salem c)
How can i add simple artifical intelligence (perceptron) to my translator?
 
Hello. I am currently working on my simple translator engine. It translates perefctly replacing words from english to spanish, in a one-to-one relation. I also ...
[1 reply] : I expect your help Ironic, isn't it? This sentence was probably lost ... (by Ganado)
A little question: Inside Github and Gitlab is possible to do the same as Git in desktop??
 
Hello. I am a programmer who is building apps more bigger in files and complexity. I expect to release a simple app on internet, and test abilities of Git to ha...
[2 replies] Last: Thanks for your help. Well, i will use it (by enriquemesa8080)
by colt
OpenGL: No triangle, only background (shader problem?)
 
Hello. I recently tried to execute a simple OGL code that should generate a red triangle over a green/blue background. The issue is that only the background is ...
[4 replies] Last: I can take a closer look later, but when I ran your program with the i... (by Ganado)
_aligned_malloc is always better than malloc?
 
I heard _aligned_malloc allocate in memory without memory fragmentation. but malloc can make a memory fragmentation. because actually malloc does not always a...
[9 replies] Last: Yeah, really. (by kbw)
Runtime error (Heap-buffer-overflow)
 
Question was to remove duplicates from a vector in place. Here is my code:- class Solution { public: int removeDuplicates(vector<int>& nums) { if(...
[6 replies] Last: On the subject of rolling ones own, and drifiting off topic, I once fo... (by Repeater)
by volang
Static const only created once?
 
void xz() { static const vector <string> find = {"val", "val2"}; } I dont want to create the variable "find" all over again every time I call this function....
[10 replies] Last: The overhead of using std::string would be quite irrelevant here; th... (by JLBorges)
by ap123
C++
 
Can anyone explain this to me? #include <iostream> #include <cmath> using namespace std; int main(){ int i = 0; while(i<10){ i=i*2; cout << ...
[3 replies] Last: It might help you understand what's happening if you also print the va... (by dhayden)
Error when indexing into array
 
Hello, I assume this is simple to fix but I cannot get there. The expression: crd[(int)time/dtime] i is of type int and both time and dtime are of type r...
[2 replies] Last: That did it! Thanks! (by cppmatt)
Read file into 2D array
 
Hello, I am trying to read the contents of a text file into a 2D array in a macro and this attempt crashes my program. Where am I going wrong? int Nts = 4; ...
[8 replies] Last: Thanks, dutch! (by cppmatt)
December 2019 Pages: 12345... 10
  Archived months: [nov2019] [jan2020]

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