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

by colt
Massive memory leaks leads to "corrupted double-linked list:"
 
Hello, I recently added some code that creates a dynamically allocated, bi-dimensional array, fills it with relevant information and then pass one value of this...
[3 replies] Last: Why plain arrays at all? The std::vector would manage its memory with... (by colt)
Public or Private in this case?
 
Let's suppose I have created a GUI calculator, I have these variables Private one; Private two; Private three; ............. etc. The calculator is an a...
[9 replies] Last: Well, thanks for your explanation. (by omer123)
by Gagavn
How to input and output without Cin and Cout - pleas help me !!
 
Hi guy i am new nember and nice to meet verry body in forum I have a question: How to Input and Output Without Cin and Cout . Thanks for read my question ! ...
[6 replies] Last: For output, write busy loops with varying iterations along with sleeps... (by Ganado)
by mbozzi
How do I use string_view where a C-string is expected?
 
I've written a function foo() whose purpose is to call something that requires a C-string: void foo(std::string_view x) { std::puts(x.data()); // expects...
[6 replies] Last: Just wanted to post an update: I've been using something like the c_... (by mbozzi)
Event System Implementation Issues
 
Hey everybody, lately I've been working with game engines, trying to understand how they work, starting to make my own, etc. However, I've decided not to start ...
[1 reply] : According to the documentation I found on line, you made a small mista... (by doug4)
I/O files, functions,error checking
 
Hi guys, I have to write a program that does the following: Write a program that reads data from an input file named “input.txt”, and produces two outpu...
[2 replies] Last: All I have right now is what I posted. I only have the main.cpp file s... (by explicit)
how to declare and initialize variables off main.cpp for use on main.cpp
 
I have 30+ variables grouped together in my main.cpp that I would like to move the declaration and initialization of which to another file. I've tried creating ...
[10 replies] Last: Thank you, I have a lot to study. It might be that the answer is to ke... (by technologist)
by deanF
Help Printing templated AVL tree
 
i have no idea as to how i would write a print function for this program and i was hoping somebody could show me i will attach my TreeType.h and main below T...
[1 reply] : You need to visit every node and output it. Recursion can be applied. ... (by Repeater)
by d1456
one-dimensional array
 
Create a one-dimensional array to read 20 alphabetical letters (your program should be able to detect and print out an error message if a non-alphabetical lette...
[8 replies] Last: if (isalpha(letter )==0); is wrong. it should be if (isalpha(lette... (by Repeater)
Error in ./a.out: free() issue
 
Hey, I'm getting an error when deleting a dynamic array in the deconstructor of an object. This is the error: *** Error in `./a.out': free(): invalid next siz...
[1 reply] : movie m(name,classification,critic_rating); movies =&m; } // <-- m ... (by Peter87)
trace driven memory simulator
 
a trace driven memory simulator and run a set of experiments using simulator Simulator should accept the following command-line option: -c < capacity > wi...
[5 replies] Last: I assume this is some kind of school assignment. If you have no idea w... (by helios)
Inheritance going wrong
 
I'm working on a simple game framework based on SDL2. I have two base class types; - item (which is anything that can be drawn on screen) - group (which is ...
[2 replies] Last: Ah, thank you Thomas1965. I had the wrong idea about how virtual fun... (by newbieg)
How to change the function such that it guarantees a linear time worst case runtime.
 
struct Node { T data; Node *next; }; Node *front; Node *back; The below is a function that removes the first occurence of x in a...
[3 replies] Last: See http://www.cplusplus.com/reference/list/list/erase/ and consider r... (by homy18)
C++ | I/O
 
Write the program in c++ that the names of the files to read are passed to the program as command line arguments. The file should be open and close. You have...
[1 reply] : rather than getline, you might want to just read word by word... stri... (by jonnin)
by rcx11
Pointer to Member Function (I know; I'm not supposed to)
 
I'm trying to set up an equations solver using the GSL root finder routines. In short, I have various combinations of equations that are functions of two variab...
[6 replies] Last: Well, if you are calling a static member function, you no longer need... (by doug4)
How to remove the 'k' number of elements in a linked list.
 
How to remove the 'k' number of elements in a linked list. I search the many sites on the internet but found nothing. Can anyone please give the link to the ...
[7 replies] Last: Sorry, I missed that. in the case of splitting a list, you do want to ... (by jonnin)
Help with threads
 
Hello everyone! Here is the code of the Universal Turing Machine from a few text files which can execute either 1.txt or 2.txt or 3.txt or 4.txt. I need to fig...
[2 replies] Last: > I need to figure out a way how can I make this Turing Machine parall... (by JLBorges)
Help Needed in these Calculations
 
#include <iostream> #include <cmath> #include <string> using namespace std; int numberOfPeople; int cookiesPerBatch = 12; double numberOfBatches = (numb...
[3 replies] Last: you assign numberOfBatches before you read in numberOfPeople. you c... (by jonnin)
by cmisip
How to access a derived pointer member from base?
 
#include <iostream> #include <string> #include <memory> #include <stdio.h> #include <string.h> class RGB { public: int num=0; uint32_t *color=NULL...
[10 replies] Last: Thanks Guys, These are really good answers. I might be trying to solv... (by cmisip)
"while" problem
 
hello , i have a some problem , if i write yes or no programme working succesfull but if i dont write yes or no i mean if i write anything else programme say "p...
[5 replies] Last: Right, I was more referring to the act of returning than the value. 0 ... (by uplime)
September 2018 Pages: 12345... 9
  Archived months: [aug2018] [oct2018]

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