General C++ Programming - July 2014 (Page 7)

Int, long int, and string
 
I have a simple question that im not sure of. When do we know when to use int, long int, and string. I know its size but in terms of numbers or characters can y...
[2 replies] Last: http://www.cplusplus.com/forum/beginner/110492/#msg603267 (by JLBorges)
by Niven
A* Search keeps crashing
 
I'm attempting to implement A* search in one of my programs, but everytime I run it, it crashes. Relevant code: bool SortShortestFirst( Path lhs, Path rhs ) ...
[3 replies] Last: > the queue would end up holding enough data that the stack ran out of... (by ne555)
Access Reading Violation
 
Im working on a BST homework, and I have been doing alright, but I keep running into this error that I have NO idea how to solve. This is the piece of code ...
[3 replies] Last: My code is quite large. It's actually why I shrunk it down. But I will... (by Bonster)
for loop help
 
I have this for loop that does this: let say n = 8 and node = 4 n: id: 0 1 2 3 0 1 2 3 id = 0; while (id < node){ for (i = id + 1; i <=...
[1 reply] : I don't know how to explain it =..=. So is this what you want? #in... (by lsk)
Calculate variance in C++?
 
I am using the valarray function to take the numbers in myarray, and subtract them from the mean to obtain the second array. Please see the attached image. It g...
[1 reply] : Why can't you just myarray -= mean; ? Then print it, and then use it ... (by Duthomhas)
How to read files inside a folder using the value from another input file
 
Hi. I am currently doing my assignment and it requires me to open a folder, read a file, and then open a file in the folder with the same name as the one in the...
[no replies]
Puzzled about virtual function using in pthread
 
Hello. I write a job class base to do some background work using pthread, but I encounter some strange problem. And, my code looks like following: #include ...
[no replies]
Rehashing the Matrix
 
Hey guys, I'm new here so forgive me if I'm doing this wrong. I have this assignment where I have to create a map based hash table for a sparse matrix. The...
[1 reply] : Here is the source code for the class #ifndef SPARSEMATRIX_H #define... (by theguy920)
by tcmn
returning the number of elements in a list
 
I am given an array with n elements but need to write a function where it returns n-1 elements. Do I need a loop for this? Or must I write a prototype... Her...
[5 replies] Last: The basic principle is: index of current node = 0; while (index of ... (by Duthomhas)
Need help with age finding program.
 
The problem is that I need to figure out the user's birthday in months, days, hours, and minutes from today's date. Here's what I have so far. #include<iost...
[3 replies] Last: Oh, okay. Wow. That's way different than what I had. I'll try workin... (by nibiruis)
confusion about reference and pointer
 
int myvar = 5; int * ptr = & myvar; int & rfr = myvar; void funS(int Spar){}; void funP(int * Ppar){}; void funR(int & Rpar){}; now what do you say ab...
[3 replies] Last: Thankyou guys yes this does help a lot I will figure out timely when i... (by danicpp)
Assigning Random Value
 
Hey guys, here is my issue. As shown in the code below, I'm using getline, and stringstream to assign an input to a value. I, for the life of me, can not find/f...
[6 replies] Last: No worries, we've all been there! Ha (by ColtonBoyd)
Interesting use of auto to make a foreach macro
 
I thought I'd display my fun use of the new C++11 auto keyword to create a compile time foreach. It only works for STL collections, or anything that implement...
[2 replies] Last: Oh snap! (by flamewave000)
by bw119
outputting a partially filled array onto a text file
 
I have a partially filled array and I want to put that into a text file. Say I don't know how partially filled it is. How would I stop at the very end of the ar...
[1 reply] : You're going to have to determine how many entries are in the array. ... (by AbstractionAnon)
Initializing static member just once throughout
 
Here I'm trying to initialize PersonFactory::ethnicSurnames just once for the entire run of the program: #include <iostream> #include <string> #include <v...
[5 replies] Last: What I meant was if it was initialized outside the class as: const... (by prestokeys)
by LMUZZY
Need better understanding + need to solve an error.
 
I'm learning C++ off of this very website, and i'm up to this section : http://www.learncpp.com/cpp-tutorial/1-10a-how-to-design-your-first-programs/ im trying...
[4 replies] Last: Thanks, got it working perfect now =D (by LMUZZY)
Help using STL Properly
 
Hello everyone! I am in need of some help with a homework assignment. It's basically creating a file indexer using C++. I have 2 separate files that I ...
[7 replies] Last: > Can someone offer a stepping stone? > I'm good at figuring it out i... (by JLBorges)
Seeing a Memory Leak in Task Manager
 
Hey, I created a program and I didn't think I was freeing dynamic memory correctly so I opened the task manager and ran my program concurrently; Everytime I pu...
[1 reply] : From what you described it seems that you do indeed have a leak, that ... (by Z e r e o)
vector<vector<Player>> iterator
 
I am writing a tennis tournament simulator. I have two main classes to help me achieve this, a 'Player' class and a 'Tournament' class. Unsurprisingly the 'play...
[2 replies] Last: Thanks for the quick reply. If it helps, the class declaration for Tou... (by whitebloodcell)
Fill a SAFEARRAY with BSTR values and print to console
 
I'm attempting to fill a SAFEARRAY of 10 BSTR with the value "test" and print out to console the value of each index of the SAFEARRAY after it has been assigned...
[no replies]
July 2014 Pages: 1... 56789... 26
  Archived months: [jun2014] [aug2014]

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