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

A weird looking statement at malloc.c
 
https://github.com/lattera/glibc/blob/master/malloc/malloc.c#L212 What is the purpose of that? redefining void ?! Can someone explain it to me?
[5 replies] Last: Just delete it from the file, and see if your code builds again afterw... (by MikeyBoy)
Checking the winning condition using arrays with for loops
 
I want to create a game (connect four) in c++ using arrays and loops. 1) First I created a 8x5 board. 2) Second I am prompting the user to select the columns ...
[7 replies] Last: The reason why I say my example is O(1) is because your example is exp... (by poteto)
by rcx11
error: template argument/substitution failed: mismatched types 'T (*)(V*)' and 'long double'
 
I'm early in my work with templates. I've gotten a few to work, so I thought I understood them. However, this one is giving me some trouble. Trying to call t...
[2 replies] Last: That was the problem. I tried including the arguments in the function ... (by rcx11)
Posting text to web API
 
Hello all, I am trying to Post text in JSON format to a web api but I have no clue on how to do this. If anyone could help lead me in the right path that wou...
[3 replies] Last: See the comment in this example. You won't have the library, but the ... (by kbw)
Solving differential equations with Monte Carlo method
 
Hey guys, I have been trying to solve three linear differential equations (dx/dt = -2x +2y + 2; dy/dt = x - 4y + 4z + 1; dz/dt y - 8z + 6) using monte carlo met...
[13 replies] Last: Are you absolutely sure that your teacher intended a " Monte-Carlo " (... (by lastchance)
print variables inside printf
 
double a = 10; double b = 20; double c = 30; printf("\sum %d", a, " and %d", b, " is = %d", c); printf("stop"); No compilation errors. Run time output is...
[1 reply] : You're doing a few things wrong. And if you increase the warning level... (by tpb)
by applj
Generate non-repetitive random numbers without arrays
 
I'm fairly new to c++ and I'm making a random number generator program. Update: I've already solved the generator part but the program requires that the rando...
[9 replies] Last: not sure how to do that without arrays so i would prefer simple loopin... (by jonnin)
How to make multiplayer game
 
How do you make a multiplayer game? Are there any APIs I can use? I'm thinking of a multiplayer trap-em-up, would I need to do anything special for this type of...
[6 replies] Last: or, start simple. like checkers or monopoly or something. :P I know... (by jonnin)
by mo13
Need urgent help with this - linked list
 
Write a C++ program that implements a linked list as an abstract data type. The program must:  Be type flexible, that is, could be a list of integers, str...
[10 replies] Last: make sure the list is still sorted after all the deletion and addition... (by jonnin)
by iporu
Reverse Code C++
 
So I have this code in C++ and I have a crypted picture and the content but I only know the way it is crypted trough this code, I need to reverse it in order to...
[6 replies] Last: Thank you all for your replies, I was able to resolve it in the end. (by iporu)
How to make an object must created in heap
 
Hello, I have a struct that manages window. What I want to do is, when user(It will be a library) wants to create an object, user only be allowed to create a po...
[10 replies] Last: Thank you all! (by closed account DEhqDjzh)
Const references to literals
 
This is the code snippet that I found in the book C++ Primer, 5th Edition : const int &ri = 42; As far as I know, I am now binding a reference to an integ...
[1 reply] : You are binding a reference to const to a temporary object of type int... (by JLBorges)
by rcx11
Error: expected nested-name-specifier before 'dn_dxn'
 
I may simply be too tired, so I'm not figuring this out. I'm working with templates for the first time. I've developed an algorithm to accept a function given a...
[9 replies] Last: We could use SFINAE ( std::enable_if ) https://en.cppreference.com/w/c... (by JLBorges)
const char * problem
 
here is my code: char* test(const char *str) { char *chr1 = NULL; for (int i = 0; i <= strlen(str); i++) { if (blah_blah) { // here chr1...
[7 replies] Last: Thank you all I fixed it with your help (by closed account DEhqDjzh)
by jadj
y/n char loop c++
 
I was asked to do a program that calculates and displays an employee's gross pay starting from his name up to his days of works and absences, the program must i...
[4 replies] Last: I was keeping it overly simple as he appears to be new at it. This is... (by jonnin)
Need Help - Uninitialized Local Variable?
 
Having problem with my code I will post below. In the RPM/WPM section I used to have (LocalPlayerBasePointer + AmmoOffset) when I had this instead of (RifleAmmo...
[6 replies] Last: tpb So does that mean I have to move RifleAmmoAddress = LocalPlayer... (by pLearner)
Game Console Menu Class Problem
 
I need to make a class menu of a game console. There should appear three options in it that are: 1) Create a User (It should ask for the information of at lea...
[6 replies] Last: Your code creates the exact same result as before. No point in refacto... (by poteto)
NEED HELP-SCRIPT TO RUN AND THEN DELETE PROGRAM
 
HI,Please help! I want to create a script that will run program as administrator, and then it will delete.
[1 reply] : Assuming Windows... look up RunOnce (registry option, runs a script on... (by Ganado)
by rendy
Bellman-Ford, read nodeFrom nodeTo weight
 
Hi, I saw a code of Bellman-Ford where I have to manually input everything. So I decided to try and make it so that I can read the number of nodes and edges wi...
[1 reply] : // int a, b, w; // file2 >> a >> b >> w; // debugging // cout << a ... (by homy18)
new placement again...
 
#include <iostream> int main() { int pool ; int* p1 = new(pool) int; int* p2 = new(pool) int; int* p3 = new(pool) int; int* p4 = new(pool) int; // OOPS....
[3 replies] Last: #include <iostream> using namespace std; int main() { int poo... (by homy18)
August 2018 Pages: 12345... 7
  Archived months: [jul2018] [sep2018]

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