General C++ Programming - July 2012 (Page 27)

by ljs
set of iterators?
 
dear all, I am trying to use a set of iterators, like this set< map<class_a*,class_b*>::iterator > todelete; the compiler does not accept it. Does an...
[6 replies] Last: Not only invalidated, but just modified in any way affecting equality ... (by rapidcoder)
how to write a program using c++ that should read some particular data from a file?
 
hey.. can anyone tell me the code that could read some certain information from a file. for example: a program that should read basic information about a per...
[5 replies] Last: any answers ?? (by Utkarsh Vashistha)
template<ClassName derivedClass>
 
If I can specify a base class for a template-based container, e.g. container<Brick> wall; And I have a class derived from Brick, such as CinderBrick, then c...
[7 replies] Last: There is no need for templates if all the elements need to be derived ... (by closed account o1vk4iN6)
I need help with this loop
 
I just started C++ a week ago. and i'm working on a guess number game. Everything works fine but the loop wont exit correctly. I wanted the loop to end after th...
[2 replies] Last: You can "leave" a loop using "break". So, in place of writing cout <<... (by S G H)
by stbb24
random number problem
 
Given this array size 7x4 12 5 6 34 10 45 5 23 20 89 76 5 11 34 3 44 34 2 3 22 89 72 I generate a random number using this function ...
[6 replies] Last: i tried this so far int random(int a ) { int r1, r2; sran... (by stbb24)
Does not Compile C++ structures & strcmp in control stmt
 
#include<iostream> #include<fstream> #include <cstring> #include <deque> #include <vector> #include <functional> using namespace std; // TYPES struc...
[3 replies] Last: You could write if ( Qtz == "QTU" ) instead of if (strcmp(Qtz.c... (by vlad from moscow)
SDL 2D Rotation Help
 
I'm a bit new to programming in general. I've become stuck while trying to make a simple rotation function to work with the standard SDL library. I want to be...
[10 replies] Last: IMO You should really just let the video hardware do rotations. Maki... (by Disch)
SDL lagging cursor image
 
Hello and thank you for any help you can offer. I am currently using SDL to make a simple game. My problem lies in loading an image at the mouse position when ...
[2 replies] Last: Thanks for the quick reply. This has sorted my problem and its working... (by ewan1199)
Template pointer
 
Lets say i have a template A, and a class B. In B's constructor I pass the following argument list: class B { B(int i, int j, &A<char>); }; B::B...
[2 replies] Last: Thank you. (by Script Coder)
Fibonacci Homework
 
I am taking online university courses in C++ and I have an assignment that is asking me to write a program that: Asks the use for a specific number then disp...
[2 replies] Last: Thank you so much I don't expect anyone to do my work just needed a li... (by Yestsuae123)
While loop homework
 
I have another homework assignment that is asking: Write a program that asks the user for points in a graph. Determine what quadrant the points are in and d...
[1 reply] : while (answer == Yes) Tell me, what value does the string named Yes ... (by Moschops)
How do I make a template class that inherits a non-template class and one based on the template?
 
I have 2 classes; a World (structure) and another class that is defined by a template parameter. I want to create a 3rd class called Trainer<Scheme> which autom...
[4 replies] Last: Cubbi, I think the OP simply doesn't know exactly what his/her words m... (by webJose)
WinSock program error (1,2)
 
Hi All, When I run a simple winsock program it returns the following error. recv failed: 10054 Can some one help me to rectify this error? I also activated a...
[27 replies] Last: Either make a prototype for MyStreamWriter and place it at the top of ... (by kbw)
WHAT DOES "int argc and char* argv[]" do?
 
Hi everyone, can somebody tell me what the parameters "int argc and char* argv " are for in the main() function. I've came across this many times and i still do...
[6 replies] Last: From a game programming point of view, it makes it easier to do things... (by BHX)
Linker errors...
 
When trying to link SFML and MySQL to my program, I get bunch of nonsense error messages: http://pastebin.com/ijsmA6n1 Libraries: sfml-network-s.lib sfml-syst...
[no replies]
Greedy Algorithm
 
Hi I was recently trying to create a greedy algorithm and found good tips and source code on this site and so I thought that I would display this source code no...
[2 replies] Last: A bit useless to offer a greedy algorithm without describing the probl... (by Gaminic)
cin and cout as arguments of a function.
 
Is it possible to accept objects like cin,cout and the objects of ifstream fstream(file buffers) as arguments and then doing operations on them? If yes, please ...
[5 replies] Last: Stream objects cannot be copied or assigned, for good reasons. Here ar... (by Moschops)
about random numbers
 
Hi, --- http://www.cplusplus.com/reference/clibrary/cstdlib/rand/ ( value % 30 + 1985 ) is in the range 1985 to 2014 --- i would like to ask how can ...
[3 replies] Last: ok thanks! (by newdomingo)
by cdf
Array of Pointers to Objects
 
Can someone explain this (and maybe show me a simple example): I am supposed to code a class (Doc) that uses pointers to point to objects of a sub-class (Str...
[1 reply] : The problem you see is real. The usual method is to allocate a new arr... (by closed account D80DSL3A)
what(): std::bad_alloc Issue
 
QVector<task> repository::read() { QFile data("tasks.txt"); data.open(QFile::ReadOnly | QFile::Text); QTextStream reader(&data); QVector...
[2 replies] Last: std::bad_alloc simply means your program ran out of memory. Perhaps ... (by Cubbi)
July 2012 Pages: 1... 252627282930
  Archived months: [jun2012] [aug2012]

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