General C++ Programming - November 2017 (Page 10)

c++ directx9 center background
 
Hello, i am trying to code some graphics for a little game in c++ and winapi / directx9. I have established a background as a surface. Then i put some spr...
[no replies]
implementing push_front() for a custom vector
 
A "Try this" in PPP2 Chapter 20 asks to try implementing a push_front() for the vector class created in the book that's close to the standard library vector, to...
[2 replies] Last: The book showed insert(), so I just used that function in the implemen... (by DragonOsman)
by Exempt
Parsing a array of stucts that contains arrays
 
I've been trying to get this GLSL shader parsing to work for arrays with no luck. My goal would be to parse out all the possible uniform names from this, they'd...
[1 reply] : I did figure out a solution to this though it's not really inline with... (by Exempt)
General query about Octree Model
 
Hello All, I have gone through some of the online material regarding to Octree model,but still I have some basic queries regarding Octree Model 1) What is...
[no replies]
Word count and strings
 
Assignment: https://imgur.com/a/SU45W Skeleton: https://imgur.com/a/4da0L Its a group project and i'm in charge of Wc (word count) I want a simple explanatio...
[5 replies] Last: JLBorges did give quite good hints. If you don't know what, for examp... (by keskiverto)
by Jakjam
Calling Functions Issue
 
I am not sure what to put in the (double, int) part of my functions, because (*newArray, SIZE) doesn't work... Anyone know how to fix this? Here is my code: ...
[11 replies] Last: Good. One question though: If you do allocate memory dynamically, who... (by keskiverto)
by helios
Implementation bug?
 
I just noticed this weird behavior from MSVC: std::string s = "-1"; std::stringstream stream(s); unsigned n; assert(!!(stream >> n))); assert(n == std::...
[5 replies] Last: I ran my test program on Clang 3.8.0 on rextester.com. It set n to 0 A... (by lastchance)
lucky square c++ help??
 
I'm trying to create a lucky square. A lucky sequence means that every number after the first two is the sum of the two preceding number. A lucky square means t...
[1 reply] : Don't double post. Please use your other thread. (by lastchance)
Simple String Class Segmentation Fault
 
I am using c-strings and dynamically allocated memory to create a simple string class. I am almost there, but now I am getting a segmentation fault when I run i...
[1 reply] : Remove CPP file, line 11. (by kbw)
Random numbers in loop
 
I want to get a different array in every cycle of loop but this code is creating the same array every time in loop. Please help! I tried putting srand() functio...
[2 replies] Last: oh I get it. How fool I am... :~ (by Talha Bin Adam)
Dynamic Programming : Tabulation gives time out for some cases but memoization passes successfully.
 
Hi ppl :), I was solving a DP problem and found that on submission, memoization technique passes the test where as tabulation fails. The problem : given a se...
[no replies]
How to input a sentence (string with many words)
 
I have tried cin.get(t,1999);, I tried std::getline(cin,1999), I cant seem to find any solutions, in throws this error: Error: unable to find coincident func...
[3 replies] Last: Almost, you need std::getline( std:: cin, t); (by goldenchicken)
Writing to files. How?
 
I have an array of objects, whose parameters I can transform into one string, I now want to write those strings to a text file for later use. Th thing is I ha...
[2 replies] Last: I will try it now, thank you in advance. Lets see, it........WORKS! (I... (by Demrottens)
Some strange type-problem
 
Hey! I need some help with a strange behaviour on different types. I have a class ("clsMem" - see below) used to organize data in memory, which shoud be fast...
[7 replies] Last: good! That is why I was saying to deal with everything in bytes... y... (by jonnin)
by dap315
Insert function for a Binary Search Tree
 
Hi all, I'm using recursive functions to insert a node into my binary search tree. The program works by creating a root node if there is none. Root is a poi...
[1 reply] : What do you do on line 4? A compiler does not accept that, because: e... (by keskiverto)
HELP PLEASE :(
 
Okay so i am trying to make an expand function for a vector class that doubles the capacity (cap) and makes a temporary array( with a pointer). I'm supposed to ...
[8 replies] Last: Thanks for clearing that up but i still have a destructor (declared e... (by Chervil)
by Johnn
Not too sure how to move on from here. Using linked list to search?
 
Question: Create a Linked list of nodes. Each node should have student names,age,course num,grades and pointer that is used to link the next node in the list. U...
[1 reply] : #include <iostream> #include <string> // <cstring> // using namespace... (by JLBorges)
by BJ19
I need help starting my C++ HW assignment.
 
How would I start this program off? Step 1) Declare 2 global constants: NUM_ MONKEYS = 3; ...
[8 replies] Last: @BJ19 For #5 Create a function, like void Least(string monkeys , int ... (by whitenite1)
buggy highest element program - help needed
 
It's intentionally buggy in the book. I need to fix it. But there's also another problem for me. // Osman Zakir // 11 / 10 / 2017 // Bjarne Stroustrup: Pro...
[1 reply] : Okay, never mind about the line number; my own updated code got longer... (by DragonOsman)
Pointers as iterators - Help needed
 
A "Try this" in Chapter 20 has the following specs: Write a function void copy(int* f1, int* e1, int* f2) that copies the elements of an array of int s defined...
[5 replies] Last: Yeah, that seems to have worked. void copy(int *f1, int *e1, int *f2... (by DragonOsman)
November 2017 Pages: 1... 89101112... 16
  Archived months: [oct2017] [dec2017]

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