General C++ Programming - April 2012 (Page 43)

by dww
g++ does not give expected warning
 
hi, I tried compiling the following program with g++ for Windows (MingW) version 4.6.1: #include <iostream> using namespace std; int main() { int ...
[5 replies] Last: > Is this because they are both the same size (4 bytes) on my machine?... (by JLBorges)
unordered_map not unordered
 
#include <iostream> #include <unordered_map> #include <string> typedef std::unordered_map<std::string, int> mm; int main() { mm m; m.insert( m...
[5 replies] Last: But i need unique elements and not sorted, how to achive this? You... (by cire)
Dinamic memory new and delete
 
Hi guys, I don't speak english, but I going to try it, problem: int *p = new int ; delete p; //p = NULL; if(!p) { cerr<<"ERROR"; } when "de...
[11 replies] Last: how can I know if [...] a variable (p in this case), is deleted or no... (by Cubbi)
How to read and process one character at a time?
 
I am writing a program that I need to be able to read and process one character at a time in C++. Do I use a string to do that? If so how would that go in synta...
[3 replies] Last: Repeating the same words in another sentence does not improve specific... (by Duthomhas)
Help please
 
I was wondering if i did this right.. Write a complete C++ program, including at least one good comment, to do the following: your program will compute valu...
[no replies]
passing variables located within pointer-type classes
 
Hoping some awesome C++ guru can help me out. I've had many problems understanding pointer variables in the past, and it seems to be catching up to me. I...
[4 replies] Last: I actually just got the compiler to get past that point using: funct... (by SheerSt)
can't push back non-int 2D vectors
 
I'm attempting to push_back several two-dimensional string vectors. However, I receive several error messages when I do. Here is an example of trying to push_ba...
[6 replies] Last: If you want to create and fill a 2D vector with default values (say, z... (by Duthomhas)
infile wont read second time
 
Hi I have this code infile.getline(Firstname,size,'\n'); infile>>Lastname; strcpy_s(CheckSentinal, Firstname); strcat (CheckSenti...
[no replies]
Mutual Class problem - A receives B object in method and B uses A as parameter
 
Hi! I am having problems with two Classes. In Class Position one method received the instance of Class Swarm . But in Class Swarm I use the Class Positio...
[3 replies] Last: Can you please post the exact error output? So in Position you forwar... (by clanmjc)
Inner Class Data From Outside
 
Hi, I have more or less the following structure; Class A { ... class B; friend class B; ... Class B ...
[3 replies] Last: Show the definition of A::getClassB(). (by webJose)
My Homework....
 
Well, I'm behind in my class by 3 labs and an exam.... I learn better by seeing code in action to learn how its used so if anyone could do this or make a progra...
[1 reply] : Create a class to store the following information for each person: Fi... (by Moschops)
How to block a function
 
I have a std::queue of sounds to play (in OpenAL) and I need to know how to block my threaded function so that I don't end up playing all of the sounds in the q...
[7 replies] Last: Thanks. Still learning about threading, I'll look up mutex's. The m... (by Stewbond)
by Zapeth
Is there a strlen method that goes until last null?
 
Hi there, title is my question. I have a unsigned char recieved_data ; that gets filled with some characters, among them are also multiple null characters. ...
[8 replies] Last: thanks I have it now working, should have thought of that before :P (by Zapeth)
Binary search trees
 
Can anyone describe in plain language (no code needed), an iterative algorithm for locating an element stored in a binary search tree? I can only think of it re...
[1 reply] : Check node data, if its greater then the data your searching for go le... (by naraku9333)
Methods for Dynamic Compilation and Loading
 
I'm looking for advice on the best way to do dynamic compilation and loading in C++ (I know the general answer is "don't", but there are good reasons why we nee...
[no replies]
While loop within a while loop
 
/* This program will compute the temperature of a gas using the gas law.*/ #include<iostream> #include<fstream> #include<iomanip> #include<cmath> usin...
[2 replies] Last: I got it. I ended up using a for loop then a nested for loop, and it w... (by fufugrayson)
by Bouya
Header file
 
Hi I have this header file: #include <string> namespace XX { class WifiChannel; class WifiPhy; class WifiMac; class WifiNetDevice : public NetD...
[1 reply] : C++ files are read from top to bottom. A declaration must be available... (by closed account S6k9GNh0)
by eivets
Prime number code
 
I wrote this code for c++ on Dev C++ and it says my ??WHILE?? phrase is incorrect Please help. #include <iostream> #include <math.h> using namespace std...
[4 replies] Last: Thank you so much it now works. I am very new to C++ and am learning f... (by eivets)
in file included from main / string does not name a type
 
Hello guys. I'm currently learning C++ nice and slowly. However, I've ran into a problem. I've tried to do a little with the string class, but I am failing utte...
[7 replies] Last: ;D (by S G H)
How to solve this problem of linked lists.
 
I want to do a problem that. I am given two linked lists L and P. write a functions printLots(L,p). such that the elements in L that are in positions specifi...
[1 reply] : Sounds like you've answered your own question. Use the values from P ... (by clanmjc)
April 2012 Pages: 1... 4142434445... 49
  Archived months: [mar2012] [may2012]

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