General C++ Programming - April 2011 (Page 22)

Keep Getting Error
 
I'm trying to write an overloaded - function. Right now I keep getting an error at the else statement where I break into the second condition of the program. ...
[2 replies] Last: You have a semicolon in after your first if statement. (by Zhuge)
by Katma
Base Conversion
 
Hi all, me again. Now I'm working on a base convertor, and even though he gave us all these formulas(which I do understand!), I don't know how to make it work...
[2 replies] Last: Base conversion is where you change letters or numbers from one base t... (by Katma)
Throw exceptions question..
 
I am dealing with fractions and want to throw an error if they try and divide by zero. Here's what I have tried... if(denom == 0) throw "Can't divide by ...
[5 replies] Last: Yea, I decided to go with the try/catch route. Thanks (by kraigballa)
Reading std::vector <std::vector <TVector3> > --- please help
 
Hello, Can anybody PLEASE help me? I want to read each element of a std::vector <std::vector <TVector3> > obj1; Here is what I am doing; for(int i=...
[4 replies] Last: Just notice that, unreadable as they may seem, template error messages... (by filipe)
stl vector for loop
 
how do I create a for loop and cin.getline using of the undeclared minimum size?
[1 reply] : http://www.cplusplus.com/forum/articles/1295/ (by Bazzy)
Unexpected behaviour when using function as default argument
 
The following code works as expected: template <class T> void fn(const T& arg = T()) { ... } Defaulting the parameter to 0 when an fn<int> is called, fo...
[2 replies] Last: EDIT EDIT: Ah fixed it now. I had implemented the relevant function (w... (by anonymous23323124)
Control Statement Issues
 
First off I will state that this is a project assigned for CSIS123, and I am not looking for a solution, I just need tips. I am a beginner programmer and I hav...
[3 replies] Last: Ahhh...thanks for the nudge. (by DrShroom)
Using Classes for C++ project. Chapter 8
 
This is my assignment for Ch.8 in my c++ class. I understand how classes work but I'm lost on to where to begin the assignment. I know its lengthy and I have th...
[1 reply] : How much do you have so far? If you haven't started then it should loo... (by Browni3141)
Creating A List - issues
 
Hi all, new to here, so I hope I post things right. I am currently going through some work, in which I have to manually create a list, rather than using the in...
[2 replies] Last: Much appreciated. I wasn't aware I was essentially making a local list... (by InfernalEdge)
To findout smallest and largest numbers from text file
 
Pl guide me how to write a complete programme to findout a smallest and largest number from given problem: e.g. 200 250 120 5 28 30
[4 replies] Last: Try and do it for yourself based on filipe's guidance, if you get st... (by lnk2019)
I wanted to know if this is one 2D array or 3 separate ones due to the for loops, not quite sure?
 
#include <iostream> using namespace std; int main() { int arr ={{1,2,3},{4,5,6},{7,8,9}}; for(int i=0; i<=2; i++) for(int j...
[2 replies] Last: because the question said that this does not involve three separate 2D... (by NYCrealist123)
by Gldnbr
Adding 2 numbers using stack?
 
I'm trying to solve this math problem using stacks: 10-4*2+8/10 I know I have to create two different stacks (numbers and operands). I want to start ve...
[2 replies] Last: #include <iostream> #include <stack> using namespace std; int add(in... (by Gldnbr)
function in classes
 
Hi, Basically i have 3 classes derived from and abstract base class. In my main i have a switch case statement with three case's one for an object created of...
[1 reply] : Try virtual string void()=0; and string newcourse(string course, do... (by mbcx7mm3)
file path conversion
 
Hi all, I am trying to write a little function to convert a file path into one that can be used by ifstream. I need the string file to be in the form of: C:...
[6 replies] Last: Thank you! What you have written makes sense, but what makes more sens... (by tpygott)
AI
 
Is it possible to make an Artificial Intelligence out of c++??..haha..just asking :)
[19 replies] Last: I'm in the Computer Security business, so yeah, kind of a no-brainer ;... (by Acr)
efficient data-reassembly, use iostreams?
 
Hi, I wrote a network sniffer that re-assembles TCP streams as network packets come in. On Linux, the packets are memory-mapped from kernel to user space. In o...
[4 replies] Last: If you want a stable code Acr, you can have a look at libpcap, i think... (by bartoli)
Implementing a Concatenates Function
 
I am having trouble writing a program that uses two helper functions that concatenates the strings a and b to the buffer result. It can hold result_maxlength + ...
[3 replies] Last: should it look like.. create temp variable loop through the eleme... (by ashworcp)
About pointers to member function!
 
Well, I was wondering how to write a program that displays the address of a class's member function! (I thought of using pointer to function) Can anyone help m...
[1 reply] : http://www.goingware.com/tips/member-pointers.html (by Acr)
map with const char*
 
#include <iostream> #include <map> int main() { GetName1(); const char *c ="vivek"; GetName2(); return 0; } char* GetName1() { if(...
[1 reply] : Replace GetName2(); with GetName2(c); in main.... (by Acr)
Assigning function to a class's events
 
Hello! i'm trying to compile this code (this is a real code adaptation)... file: A.hpp: class A { public: A(void (*aEvent) (A *, char)): ev...
[4 replies] Last: Because you're passing in a this pointer, I'd bet this isn't supposed ... (by kbw)
April 2011 Pages: 1... 2021222324... 37
  Archived months: [mar2011] [may2011]

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