-
Replied To a Post in why random() is not returning 2?
What is `random`? It's not a standard function. Did you define it yourself or does it come with Turbo C++? Anyway this `random` function probably needs to be seeded just … -
Replied To a Post in Function Problem
In C++ pre-11 you'll need to cast the first argument to a floating point type in order to tell the compiler which overload to use (there are no overloads taking … -
Began Watching Function Problem
I'm trying to understand this function. I try to compile an run it, but it gives an error message at line 12. Thanks. #include <iostream> #include <string> #include <cmath> using … -
Replied To a Post in Function Problem
> it gives an error message at line 12 What's the error message? -
Began Watching Using a parsing algorithm to generate a list of tokens?
Hello, I recently took a course on assembler/compiler construction. In it we covered parsing algorithms such as LL(n), LR(n), LALR(n), and SLR(n). I understand how these parsing algorithms can be … -
Replied To a Post in Using a parsing algorithm to generate a list of tokens?
You do not use parsing algorithms to generate a list of tokens. The list of tokens is the input to the parsing algorithm. The output of the algorithm is generally … -
Replied To a Post in template parameters as base class - incomprehensible stroustrup
First of all `sp::bool` does not exist, you probably meant `sp::b` there. But even then it won't work because ADT is about where the type of the argument is defined, … -
Began Watching template parameters as base class - incomprehensible stroustrup
I am reading the (otherwise excellent) The C++ Programming Language (4th edition - Hardcover) (Stroustrup) and I cannot understand about 4 pages of it despite a lot of attention to … -
Replied To a Post in template parameters as base class - incomprehensible stroustrup
> A node needs to point to another node, not to a DATA. It does. `node<DATA>*` is a pointer to a node. > Why not just use the following (apparently … -
Began Watching A pointer is an iterator, or an iterator is a pointer?
i'm not sure if a pointer can do the job of an iterator, or otherwise, or they are different things? -
Replied To a Post in A pointer is an iterator, or an iterator is a pointer?
Pointers are iterators (random access iterators to be specific) and they are in fact commonly used as such. For example `std::vector<T>` uses `T*` in most (possibly all) implementations (except in … -
Replied To a Post in Differences between the following declarations
I think there's been a misunderstanding. I didn't say that the method `m` should be defined in the interface. The method can be defined in any class you want as … -
Began Watching C code errors
**what can i do with this errors?please help me! thanks** >#ifndef WS2811_h >#define WS2811_h >#include <avr/io.h> >#include <util/delay.h> >#include <WS2811.h> **Error 1 unterminated #ifndef** >typedef struct __attribute__ ((__packed__)) { > … -
Replied To a Post in C code errors
I think the problem is that it does not recognize `uint8_t` as a type name because the `stdint.h` header was not included. That would explain why the error happens "before … -
Began Watching Differences between the following declarations
What is the difference between `CoffeeInterface<Beverage> cup1 = new Coffee<Beverage>()` and `Coffee<Beverage> cup2 = new Coffee<Beverage>()` `Coffee` is a class that extends the `CoffeeInterface` Is `cup1` an object or can … -
Replied To a Post in Differences between the following declarations
Yes, `cup1` is an object (or rather it's a variable referring to an object - just like `cup2`). The biggest difference between `cup1` and `cup2` is that, if the `Coffee` … -
Replied To a Post in lambda in for_each param.
> still the same error... What's your current code? -
Began Watching lambda in for_each param.
void StrVec::free() { if (elements) { for_each(elements, first_free, [this] (std::string* p) { alloc.destroy(p); }); alloc.deallocate(elements, cap - elements); } } produced this error: [Cruel Error :(](http://s3.postimg.org/4p1vfhs9f/New_Bitmap_Image.png) it was the second … -
Replied To a Post in lambda in for_each param.
Is `elements` a collection of string pointers or of strings? Judging from the error messages I'd say it's the latter, so your lambda needs to take a string or string … -
Replied To a Post in Pointers and Objects
> So by writing the line "`objNumber* num1obj;`", you have created a pointer variable in heap Like all local variables `num1obj` lives on the stack, not the heap. -
Began Watching Pointers and Objects
I have a question. I am trying to sere into my brain how pointers work and just when I think I got it a new problem arises. So I think … -
Replied To a Post in Pointers and Objects
`num1obj` has not been initialized and is thus neither pointing on the stack nor on the heap - it is pointing nowhere at all. Therefore dereferencing it invokes undefined behavior. … -
Began Watching Notation Confusion
I was given a project to do, but I don't understand this notation and am rather confused, so I don't even know where to get started. I am supposed to … -
Replied To a Post in Notation Confusion
Can you clarify what exactly you don't understand? The arrow means assignment, `for i <- x to y` means a for loop that iterates `i` from `x` to `y` and … -
Began Watching Immutable object
What is an immutable object and how would I use it? -
Replied To a Post in Immutable object
An immutable object is an object whose state can't be changed in any way through it's public interface. So it has no public variables and none of its public methods … -
Began Watching Differences in C#
What are the differences between Dynamic Var and an Object in C#? -
Replied To a Post in Differences in C#
If you declare a variable as being of type `Object`, you're not going to be able to call any methods on that object other than the ones defined in the … -
Began Watching Finding multiples, not working for reasons...
Hey, I tryed the first problem of the Euler project, but for some reason the code bellow is not give me the correct answer: def multiple_sum(multiple=3): x = 0 for … -
Replied To a Post in Finding multiples, not working for reasons...
You're counting all multiples of 15 twice (once as multiples of 3 and once as multiples of 5). -
Began Watching def, plg explain little bit more about this
def y we need this in ruby i am beginner of ruby i donot understand what is use of def with out this we make code also i think according … -
Replied To a Post in def, plg explain little bit more about this
You need the `def` keyword to define methods in Ruby. The reason that you need a keyword for this is that the creator of Ruby decided that was the most … -
Began Watching Issue with Pointer
hey everyone! having a small problem with my pointer. I'm just trying to scan an array using a pointer but when i print it it shows me only zeros. Any … -
Replied To a Post in Issue with Pointer
> Instead of creating an array and a pointer just create a pointer and allocate memory. Why do you find that preferable in this case? str = (char *)malloc(sizeof(char)*20); // … -
Replied To a Post in weird int declaration
Yes, VLAs and implicit casts from void are not allowed in C++. You'll have to compile this as C code. -
Began Watching weird int declaration
Can you please explain what this weird int declaration does. Here is the block of code. void show(void *u, int w, int h) { int (*univ)[w] = u; printf("\033[H"); for_y … -
Replied To a Post in weird int declaration
VLAs are perfectly valid in C99 and "GNU89" - the only reason it wouldn't work with gcc/MinGW is if you explicitly set the standard to C89. And it doesn't work … -
Began Watching Game Takes away TOO much Gold
So I have a button which adds a "Miner" then removes the cost of the Miner. The problem is that it is taking away too much, double the cost, and … -
Replied To a Post in Game Takes away TOO much Gold
> The problem is that it is taking away too much, double the cost System.out.println("Calc: " + this.curGold + " - " + goldValue + " = " + (this.curGold … -
Began Watching Can someone please please tell me how to install haskell and make it work
I am trying to install haskell on xubuntu precise for my haskell class and I cant get it to work. I keep getting 'prelude' module is not available and I … -
Replied To a Post in Can someone please please tell me how to install haskell and make it work
How exactly did you install GHC? Did you install anything Haskell-related other than the main GHC package? And what's the exact error message you're getting? -
Began Watching Understanding Algorithm (Document Concepts)
I'm trying to implement an algoirthm descirbed here: http://pub.uni-bielefeld.de/luur/download?func=downloadFile&recordOId=2497720&fileOId=2525546 The purpose of that algorithm is to create a concept hierarchy based on a document corpus. For instants, a "Dog" concept … -
Replied To a Post in Understanding Algorithm (Document Concepts)
> I believe that H(t1) stands in for a list of all the synonymes of t1 According to the paper it stands for "a set of tuples (h, f), where … -
Gave Reputation to JasonHippy in First steps in Haskell
I don't know of any built in pow function in Haskell (I'm still a novice with it myself), but off the top of my head, you should be able to … -
Began Watching First steps in Haskell
I am trying to learn a bit of Haskell but I am having some problems with understanding how to make programs with pow*. For example I have to create the … -
Replied To a Post in First steps in Haskell
> I don't know of any built in pow function in Haskell Why don't you count `^` as a pow function? > powthing :: Int -> Int Unless you have … -
Began Watching Semantic analyzer
I need a simple c++ code that prints the semantic errors of the compiler. Can anyone help me please? -
Began Watching compiler construction
i have a project of constructing vompiler using C++ language. but i don't know how to make the lexical,syntax and semantic phasse and how to generate errors. can anyone help … -
Began Watching Easy dynamic programming - uva 147 ,
the problem is about coin change - "how many ways you can change 3,5,10 dollars if you have 5c,10c ...... "http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=83 the problem is solved many times on various blogs( … -
Replied To a Post in Easy dynamic programming - uva 147 ,
Let's say you have 25c and can use the 10c and 5c coins. Since 15 is greater than 10, you may use a 10c coin. If you do, you have …
The End.