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

How to edit original object through object* temp that points to original object?
 
So if I have an Object called Friend with a member called name. I do Friend* f1; Friend* temp; for(int i =0; i<2; i++){ f1->name = "BILL"; if(...
[4 replies] Last: here is a sample code: http://cpp.sh/5top3 if you scroll all the way ... (by Enoizat)
by ajiten
srand48() : Unable to compile due to scope issues on Windows in Dev-C++.
 
Dev-C++ version 5.5.2 (Windows 7) gives compilation error that occurs in the last line in main(): 'srand48' was not declared in this scope #include <sys/t...
[18 replies] Last: Very sorry, but had bad experience in getting no response earlier. So,... (by ajiten)
Accessing template parameter pack
 
Suppose I have this function: template<typename...T> void doSomething() { } and I call it : doSomething<ClassA, ClassB, ClassC>(); How can I ac...
[3 replies] Last: "doSomething()" is just a method in which I want to access the Ts th... (by mbozzi)
by bfhad
C++ inheritance and UML files// I keep an error saying no matching function for call Passenger:Passenger
 
//Person.h #include "Person.h" #include <iostream> #include <string> using namespace std; Person::Person() { id=0; name=" "; address=" ";...
[1 reply] : if you don't understand the error message, then post it verbatim || f... (by ne555)
how to sort inside a text file?
 
I have a phone book program that takes in contact information, sorts it (using bubble sort in an array list) and outputs the sorted data (last name alphabetical...
[3 replies] Last: I am not sure I understood your description of a problem properly, but... (by lowarago)
Why garbage collector could not be implemented in c++ ?
 
Hi, I just came across a statement that says Garbage collector can not be implemented in c++ On searching more about it, I found the following explanati...
[3 replies] Last: C++11 added something related to garbage collection but I've never spe... (by Peter87)
by Dummy
How to embed Pike script into C++
 
Been recently looking into pike because of it's similar syntax to C, and because I have heard you can make changes at runtime without compiling using scripts. T...
[1 reply] : What does this tell you? https://www.google.com/search?q=How+to+embed+... (by salem c)
Baseball program question
 
What is an easy way to display the score after each inning? Instead of adding it all up at the end I want it to say Home Team is winning 8-2 after the first, se...
[2 replies] Last: thanks Ganado! Makes sense! (by PistolPete10)
type name not allowed
 
i'm creating a line trace in ue4 and i'm trying to put damage on my line trace but i keep getting this error "type name not allowed" on my aai_character and my ...
[1 reply] : Use f'ing code tags when posting code! If AAI_Character is a type nam... (by dutch)
Is there any way by which a process P2 can access the local variable of another process P1?
 
Suppose there are two processes P1, P2(which is a virus) in linux. Can P2 access a local varable (say x) of P1 ? On searching on web, I found that since the a...
[2 replies] Last: Linux: http://man7.org/linux/man-pages/man2/process_vm_readv.2.html Wi... (by dutch)
Area & Volume
 
I need help writing a program to find the area and volume of a cube or cone for a given choice of input character .
[15 replies] Last: Please in future put these posts in the beginners section. such a task... (by closed account 367kGNh0)
delete from 2d vector and reset position
 
I have a csv file containing data: add, 100, 101, 102, 103, 104, 105, 106 add, 200, 201, 202, 203 read, 106 delete, 200 add, 600, 601, 602, 603 In my code...
[4 replies] Last: i'm doing this for an assignment. I need a add function and a delete f... (by poopcupine)
C++ exercises
 
Hey, I've been trying to find a good website or E-Book that would give me a good chunk of exercises. But I couldn't find any or at least challenging ones. I was...
[4 replies] Last: ... no boring exercises but by writing real, challenging programs ..... (by MikeStgt)
how to update value in 2d vector
 
Problem: i iterated through my 2d int vector and wants to update the element in the vector if it is in a range of values. This is my code: void does_exist(co...
[2 replies] Last: Using find, but keskiverto's is way neater :) #include <iostream> #i... (by salem c)
by PacR
Find char sequence inside char array.
 
Hello i am trying to make a program witch will find a sequence of chars inside char array, but my program don't work correctly need help. Here is my code: ...
[10 replies] Last: you do need to DIY Really? IMO no, not at all. It is for the first t... (by MikeStgt)
Why does AES has exactly 10 rounds for 128 bit key, 12 for 192 and 14 for 256 bit key size
 
I was reading AES algorithm to be used in one of our projects and found that there are exact number of rounds fixed in AES for specific key sizes. 128 bit ke...
[2 replies] Last: Got it Duthomhas, seems to be a statistical result which provides secu... (by kapil2905)
cannot append to vector of vectors from another vector
 
Hi, I have a csv file that I have read into a string vector. I also have another integer vector of vectors that set initial values to 0. I am suppose to check...
[1 reply] : for (int y = 0; y < diskBlocks; y++) { for (int x = 0; x < m... (by ne555)
How to know if a memory address is valid for current process or not ? (1,2)
 
Hi, This is an interview question where in I was given the following scenario : int main() { int* p = (int*) 0x1322 // This can be any random hex value. ...
[21 replies] Last: > I think we've pretty well determined that there is no standard way t... (by JLBorges)
by Flamee
Recursive function to get a string to int
 
So i'm trying to recursively create a function that takes a string such as "1234" and return it as an integer such as 1234. I can not use any libraries or the s...
[3 replies] Last: You must have changed something for your posted code returns: "20" =... (by keskiverto)
Correct use of class objects (for loops)
 
Hi, I have one main loop and a sub-loop (if statement within the loop) that tracks N = 1e7 objects while saving every individual object's properties in a da...
[1 reply] : Option 3 will of course use a lot more memory than the other two becau... (by Peter87)
March 2019 Pages: 12345... 9
  Archived months: [feb2019] [apr2019]

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