General C++ Programming - January 2012 (Page 3)

by h9uest
About std::exception --- Don't understand interface
 
Hi: My questions are about std::exception. I'm trying to define my own custom exception classes, say: class IndexOutOfBoundary : public exception { }...
[12 replies] Last: Many thanks, guys! Awesome answers! (by h9uest)
Missing ; before else
 
Hey, I am a 14 year old newbie in C++ and I tried to code a program that will dountdown from n, however, if you type abort, the program will end quicker. When ...
[12 replies] Last: Because in the beginning, the string abort = 0; therefore you need t... (by a27Stealth)
append function argument list with a macro?
 
Does anyone have an idea how to append arguments of a C++ function argument list one by one with help of a preprocessor macro (to supply them to C++ function, o...
[2 replies] Last: Can't use variadic templates just yet. Can you give an example of how ... (by lvcoder)
the most efficient way to calculate the number of digits from 1 to n (1,2)
 
Hello ! I've tried to make a program that calculates the number of digits in a sequence of numbers from 1 to n.For instance if n is 18 it should output 27.I use...
[31 replies] Last: If you have changed enum : long long { ... } to enum { ... } , you ... (by JLBorges)
Uff... Getting error in my solution !?!?!
 
Here's the question :- Problem 1: Book Sorting, (K Narayan Kumar, CMI) Indraneel has to sort the books in his library. His library has one long shelf. His boo...
[11 replies] Last: Oh yes , you are correct , what i am doing is very wrong . (by Maggi Iggam)
take adress of operator?
 
hi can i take the address of a operator function ??? e.g: bool operator==(const X&a, const X&b ){ ... } which is a non-member function in a namespace...
[5 replies] Last: It can work in the global namespace ;) (by LB)
What is the benefit of this?
 
So i am doing this what i am going to talk about quite..always. When i do exercises in books or write any type of programs, games mostly. I write that code in m...
[16 replies] Last: If you read carefully you can understand. No need to explain as i gave... (by happykiller)
Pollard's rho algorithm
 
Hi! Trying to implement Polards Algorithm: http://en.wikipedia.org/wiki/Pollard's_rho_algorithm Cant really get it right tho,i get my "X" values right,bu...
[5 replies] Last: Actually it does,i get 23 as divisor,115/23=5. (by menopaws)
saving and displaying value in a 2d dynamic c++ array
 
the values are stored wrong ... any comment?? void main() { int x,y; cin>>x>>y; int** s_Matrix; s_Matrix = (int**) malloc(x*sizeof(int*)); for (int i...
[2 replies] Last: thanks Moschops .. it worked after modifying it to s_Matrix and remo... (by hebakhaled)
can you make a header file for this main ?
 
#include <iostream> #include "graph.h" int main() { int yourMark = 1; //2-es Graph<int, false> undir_graph; Graph<int, true> dir_graph; u...
[5 replies] Last: could you write the "graph.h" file ? That was my exam and i fall. (by Oki1100)
pintools
 
Hello-- Does anyone have any experience with pintools? Ok so i got pintools all set up in visual studio using this guys instructions: http://blog.piotrba...
[no replies]
fstream with SetConsoleTextAttribute()
 
I was working on a game (it's code is currently 1650 lines long), and I came across an issue: error C2664: 'setcolor' : cannot convert parameter 1 from 'std...
[no replies]
Calculating in the Symbolic Ring
 
Is there a way to calculate inside a symbolic ring in c++? So that, for instance, I can assign a variable the value sqrt(2) and it will just keep it in the for...
[3 replies] Last: oh cool, thanks. (by Zaubertrank)
How to check if thread is done
 
Hi, I am doing a quicksort where the function call two threads , passing left array to the pivot , and right array to the pivot . i am trying to check if the th...
[11 replies] Last: No creating two threads to write to two memory locations is just fine,... (by Computergeek01)
by htown
float to binary
 
I need to write a C++ program to print the binary pattern of a float. Can anyone post examples of the reinterpret_cast function? I had trouble finding some. ...
[3 replies] Last: I used this format and it works perfectly. int i; ... (by htown)
Clear screen command for c++? (1,2)
 
What is the clear screen command for c++?
[28 replies] Last: (as I didn't bother reading half the replies for this topic) So you ... (by Moschops)
Recursivity problem
 
In my program I enter an expression, the program divides it based on + or - into subexpressions, so I can differentiate every simple subexpression or subsubexpr...
[5 replies] Last: It is difficult to decide on the best way to solve this problem. The b... (by hamsterman)
std::list vs std::vector
 
For my program I need a way to store my in-game objects. Until now I always used vector, but the I realized that I never need to actually use the operator and...
[4 replies] Last: Ok thanks! (by xander333)
Newbie C++ errors expected ;
 
Hey, when I compile script I get these errors: 13:16 character constant too long for its type (NOT AN ISSUE!) In function `int main()': 15 expected prim...
[7 replies] Last: That's OK! :) I managed to do some research and got the loop to work ... (by a27Stealth)
HELP !
 
You need to do it by yourself! We are only helping you fix errors, and explain what you did wrong. No one is going to do it for you. Start coding and we will he...
[2 replies] Last: Lol. He ran off and deleted his post. Typical. (by Code Assassin)
January 2012 Pages: 12345... 36
  Archived months: [dec2011] [feb2012]

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