General C++ Programming - March 2010 (Page 21)

Question on loops (1,2)
 
I'm having a problem with a class assignment and was hoping to get some help, as I'm at a loss. Please help! The following is the assignment: The program sh...
[27 replies] Last: now guys you win... im follow yah rules but please lets keep our lips ... (by god)
Vector sort on Z value
 
What I'm trying to accomplish is pretty simple. I have a vector full of instances of my class: vector<Particle> particles; and im sorting that vector us...
[5 replies] Last: *chrm*.... .... And if you run into an uncommon cave-eat and solved it... (by imi)
by Them
Weird while loop
 
okay maybe not so weird... while (i--) { //some code goes here... } I have never seen a while loop that takes i-- as a condition. What does this mea...
[5 replies] Last: wow... god was amazed!!!! (by god)
creating new class question
 
is my constructor and destructor ok here or do i need to initialize the arrays instructions, var_one, var_two aswell program.h #pragma once class ...
[11 replies] Last: reduce errors? cover up bugs, maybe. (by jsmith)
inline asm fails with -O2
 
the following simple piece of code fails to work inline unsigned next_exp2(unsigned x) { unsigned n; asm("bsr %0, %1" : "=r" (n) : "r" (x)); // std::...
[8 replies] Last: Thank you. I am going to submit a bug at gcc. ------- Comment #1... (by Onanymous)
Create an exe using an exe
 
This is hard to explain, but here goes. So say I made something that gives you options to do something Such as umm.. i don't know, open up firefox. I w...
[12 replies] Last: There are a million ways of doing the same thing. You can do this t... (by mackabee)
Beginners question on loops
 
When I execute the following, I get two cout statements when all I want is 1 statement telling my how many stuffed animals I've won(using 400 coupons as the ini...
[2 replies] Last: Thanks...seems so simple. Like I said, just learning this. Appreciat... (by shepp2670)
by Disch
Template overload question
 
So I have this template function which takes two parameters. The parameters can have two different types, but I want the function to behave differently if both...
[4 replies] Last: Rock on. Thanks everyone =) (by Disch)
std::map in template class -> Ok in MSVC but not with G++
 
Hi everyone, I have a problem with a template class and std::map. It seems to work fine on a friend computer using MSVC but it doesn't work on my computr usi...
[11 replies] Last: To be clear, the ambiguity of map<A,B>::iterator is between that... (by jsmith)
by Ryan99
Creating a simple hash system
 
I am trying to create a database system where I can retrieve an index based on a string key. Each person has their own entry in the file based on a unique id# t...
[2 replies] Last: (id - 1 ) * sizeof( struct ) ? Only way to eliminate collisions.... (by jsmith)
Breaking a number into it's component parts.
 
I'm stuck, I'm told to "Write a program that takes a multi-digit integer and breaks it into single-digit numbers that represent each of the places in that numb...
[4 replies] Last: The by far easiest way to convert an int to string, is to use the bran... (by imi)
delete every occurance of a specified item from a stack
 
I'm trying to delete every occurrence of a specified item from aStack, leaving the order of the remaining items unchanged. Has anyone done this before or have ...
[18 replies] Last: as i said a program i written wrote that for me from the code i though... (by Incubbus)
Calling member function that is being pointed.
 
Here is my code: #include <iostream> using std::cout; using std::endl; class foo; class bar { public: void (foo::*memberFunctionPointer)(); ...
[2 replies] Last: Well, the problem is exactly what it's saying. You are trying to call ... (by imi)
How to change the colour of certain letters in text?
 
It's been brought up before how to change ALL of the text, but how would I change just specific letters? For example how would I display ABC, but have A red,...
[10 replies] Last: Again, curses is by far the most powerful option. (by tummychow)
Undeclared Identifer
 
Good Morning! I am new to C++ and very frustrated... I am working on an assignment and keep receiving the error Undeclared Identifier, I am not sure why it i...
[2 replies] Last: Thanks... I will try this and let you know... (by kvmacias)
by ALB
How to get the average in an array
 
it a an C++ and it need to accept an array as a parameter and loop though the array adding the array elements and return their sum divided by the number of elem...
[5 replies] Last: bluecoder: for(int i =0 ; i < 5; i++) { int sum += v ; } We b... (by imi)
by maad
Writing signed TIFF files using libTIFF
 
Hello everyone! I am having a problem using the libTIFF library, maybe some can help me with that. In my program I read in a bunch of data and do some ma...
[2 replies] Last: Have you considered normalizing the data Normalizing the data i... (by maad)
How to implement stack
 
/* Fig. 3.10: fig03_10.c Nick Vincent Analysis of examination results */ #include <stdio.h> int main() { /* initializing variables in de...
[5 replies] Last: @imi my link was for the OP (by Bazzy)
variable undeclared, first use in this function!
 
#include<iostream> using namespace std; struct state { int M_count; int C_count; int boat; struct state* parent; ...
[3 replies] Last: (Putting the "struct" before some struct in C++ is optional - unlike ... (by bluecoder)
FIFO buffer, concurrent tasks
 
Hi there, my problem here is more a logical one than an implementation (which will be done in cpp) one, hence this could look a bit out of topic here, I apolog...
[7 replies] Last: I looked on the code again and immediately spotted a problem in write... (by imi)
March 2010 Pages: 1... 1920212223
  Archived months: [feb2010] [apr2010]

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