General C++ Programming - April 2016 (Page 14)

How to prevent memory leak in this case?
 
Assuming I have a class A with construct: A(int a); vector<A *> vectorForA; for(i=0; i<10; i++) { vectorForA.push_back(new A(i)); } later, if I ...
[4 replies] Last: Thank you very much, cire. (by buddha87)
Problem when reading file in binary mode
 
I have encountered some problem when i tried to read the data using binary mode, which I cant read the data that I wanted. //this is my code #include <iostr...
[2 replies] Last: I know where's the problem, its my txt file. Thanks Chervil ^^ (by jiehang)
ASAP, please
 
Hi, i am trying to make a program that writes in a square board(which is an array bool ) given the instructions saved in a string . Any ideas? How could it be...
[4 replies] Last: You are right. Thank you for your help. Im going to put this problem a... (by MrGecko)
Saving a Large Array for Quick Reference
 
I need to store 15,000,000 sets of variables a 1000 x 15000 array, in a file. The only way I know how is to just save if all with fstream into a text file, this...
[1 reply] : If your set of variables have the same size you can use a binary forma... (by Thomas1965)
C++ Data Structures
 
I see no question.
[3 replies] Last: Yeah, I saw that. I didn't want to add a post to the thread to draw m... (by MikeyBoy)
by lukew
Vector subscript out of range
 
Hi I have an algorithm which try's to find the "maximum distance" between two nodes. I have read each node from the file and that works. However, when the pr...
[1 reply] : use .size(), not .capacity() (by ne555)
Help Please ASAP
 
Can someone please give me some help. My instructor wants us to create a program using a flowchart which he has given. He expects to learn how to create them by...
[3 replies] Last: And what, specifically, are you having trouble with? (by MikeyBoy)
by bjl311
Switch menu help
 
I'm struggling with a few errors on my switch menu. Whenever the user inputs valid numbers it doesn't break. I put breaks on each of my cases and i can't get it...
[1 reply] : I put breaks on each of my cases No breaks on cases 2 and 3 More ... (by tipaye)
OpenGL - 2D Query
 
Morning, all :) I'm planning on making a simple 2D game. The game will be using OpenGL 3.2 for the rendering. After some research, I found that glVertex3i( ...
[3 replies] Last: Thank you for the replies. Moschops, how do I specify screen co-ordi... (by Interlocked)
implement OOPS concept
 
i have created a program for System of banking process which is secured by login only STAFF and CUSTOMER can access but OOPS concepts are not implemented much ...
[no replies]
passing vector to class constructor
 
I have a class that has a string, an int, and then a vector of doubles all members. my vector member is vector<double> sales; my constructor is mycl...
[5 replies] Last: The same way as you pass any other class by reference. As Abstraction... (by MrHutch)
Sorted Linked List
 
Hi I'm trying to code a program to insert 12 integers in a linked list, sort them and then output the average and sorted list. I think i have the code mostly ri...
[2 replies] Last: (*newnode).num = number; Why not use the pointer operator(->) ... (by integralfx)
Displayed lines on a screen in a order
 
I need to create a program that reads the file, and displayed 3 lanes which have the top 3 greatest numbers, from largest to smallest. ive try so many ways to f...
[1 reply] : 1. Your 'points' is a std::string. Why? You do mention "numbers" ... ... (by keskiverto)
Help with finding lowest value in do while.
 
Hello, i have this problem that i want to know an answer to it and i can only solve it by using do while and if statement's no array's... :( so the code look...
[1 reply] : A more complex condition: If the new value is smaller than the smalles... (by keskiverto)
help please!!
 
what is wrong with this statement int loopy = 1; do cout << "Body of Loop."; loopy++; while (loopy ...
[2 replies] Last: You forgot the curly braces. Also in the while condition I gues you wa... (by Thomas1965)
i cant see my results
 
int result, a=0, b=1, c=5; result = a > 5 || b < 5; What value is stored in result?
[2 replies] Last: If the source type is bool, the value false is converted to zero and ... (by S G H)
null ptr test
 
Code snippet showing null pointer check if (!array)return . How does the expression (!array) work to test for null ptr? void printArray(int *array, int...
[17 replies] Last: > but it was the implicit conversion to bool that allowed the expressi... (by JLBorges)
Read MySQL database table rows
 
Hello. So I have this C++ code: void mysql_do_ds_awards() { #ifdef USE_MYSQL char sql_cmd ; MYSQL_RES *res; MYSQL_ROW row; unsigned int num_fields...
[2 replies] Last: Take a look at this: http://www.w3schools.com/sql/sql_create_table.as... (by coder777)
Block scope and Context of local variables
 
I recently came across some unusual code. I find it to be buggy at worst and risky at best. Any comments? void TestFuction(int testValue) { char *testPt...
[4 replies] Last: > This particular compiler (tried with a few different versions of GCC... (by JLBorges)
finding x using loop
 
hello I'm a beginner and I've been trying to write a program that finds the approximate x in this equation using for loop. y= 3x^3 - 7x- 11 (0 < x < 3) #inclu...
[2 replies] Last: thank you so much :) (by sunny0902)
April 2016 Pages: 1... 1213141516... 23
  Archived months: [mar2016] [may2016]

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