• Member Avatar for sepp2k
    sepp2k

    Began Watching Need help with function using template return type whithin a namespace

    Hello, So I'm having trouble figuring out what the correct syntax is for a function with a return type that is a template type and is within a namespace. Anyone …
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in Need help with function using template return type whithin a namespace

    The syntax is right, but for template functions the definition needs to be in the header file, not the .cpp file.
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in Why do most Java people use this style

    > The compiler will not ever complain, so why should a person? That's not very sound reasoning. A compiler will also not complain when you name all your variables `variable1`, …
  • Member Avatar for sepp2k
    sepp2k

    Began Watching Why do most Java people use this style

    why do most people use brackets in this way when it comes to Java. Pospular IDEs also use this method by default class Test{ public void test(){ } } than …
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in Why do most Java people use this style

    > why do most people use brackets in this way when it comes to Java. Because that's what the official style guide recommends. > The second method is obviously easier …
  • Member Avatar for sepp2k
    sepp2k

    Began Watching Abstract Syntax

    Hey guys, i am facing a small problem here, perhaps you could give me any hints with it. In one of my courses (Program analysis) we are using a language …
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in Abstract Syntax

    I don't think it's a good idea to define only one class for all arithmetic expressions and I don't think that's what your TA meant either. What you can do …
  • Member Avatar for sepp2k
    sepp2k

    Began Watching Recursion/fibonacci

    int Cabin (int n); int _tmain(int argc, _TCHAR* argv[]) { cout << Cabin(8) << endl; return 0; } int Cabin (int n) { if (n == 1) return 0; else …
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in Recursion/fibonacci

    Cabin(8) = Cabin(8/2) + 1 = Cabin(4) + 1 = Cabin(4/2) + 1 + 1 = Cabin(2) + 1 + 1 = Cabin(2/2) + 1 + 1 + 1 = …
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in Abstract syntax tree

    Oh, I seem to have misread the last sentence of your question (I thought you wanted us to explain what an AST is and how to implement it in Java). …
  • Member Avatar for sepp2k
    sepp2k

    Began Watching Abstract syntax tree

    Hey guys, I am facing a problem with one of my homeworks, it states: The various analyses implemented in the program analysis module will make use of a number of …
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in Abstract syntax tree

    An abstract syntax tree is a tree where each node represents a syntactical element and each child of a node represents a sub-element of that element. For example for the …
  • Member Avatar for sepp2k
    sepp2k

    Began Watching Recursion

    //Hi all ,can you explain why does this functon has two returns? //How to read them? Is it like if/else? int _tmain(int argc, _TCHAR* argv[]) { int x, n; int …
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in Recursion

    The `power` function has three returns. The first is inside the first `if`, the second (which is wrongly indented) is inside the second `if` and the third is outside of …
  • Member Avatar for sepp2k
    sepp2k

    Began Watching how to add paranthesis based on priority?

    hi so this code here as i test it on paper provides paranthesis on every leaf node, disregarding priority (operator precedence) how can i make it add those paranthesis based …
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in how to add paranthesis based on priority?

    If we just take into account precedence (and not associativity), then all we need to know is the priority of the current operator as well as the one whose operand …
  • Member Avatar for sepp2k
    sepp2k

    Began Watching sprintf and pipes

    Alright so I am getting a weird problem with the following code int toDB[2]; int fromDB[2]; char * param1; char * param2; err = pipe(toDB); if(err==-1) { printf("Error on pipe …
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in sprintf and pipes

    > but the first sprintf works, the one that writes toDB[0] to param1 The first sprintf causes undefined behavior just like the second does. Some times undefined behavior means that …
  • Member Avatar for sepp2k
    sepp2k

    Began Watching Simple question

    HI and good day to all, Since my 2nd year of my uni life, i have hardly touch C++ programming especially OOP in C++.Now starts my revision on C++ OOP. …
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in Simple question

    "instead"? Don't you get all four? Anyway what happens is that first the super class constructor is called (causing "B::B(3)"), then the member constructors are called (causing "B::B()" because of …
  • Member Avatar for sepp2k
    sepp2k

    Began Watching how to put the result of multiblying 2 objects in integer variable

    **this is the code and it keeps giving me a red line under (z=v2*v1),,please help me finding the mistake :( :( thanks ^_^ #pragma once using std::cout; using std::cin; using …
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in how to put the result of multiblying 2 objects in integer variable

    The return type of your `*` operator is `vector`. So when you return a `double` from that operator, it gets automatically converted to `vector` (via your constructor - if you …
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in warning too many arguments for format ?

    You must use format specifiers at the places in the format string where you want your arguments to appear.
  • Member Avatar for sepp2k
    sepp2k

    Began Watching What does this error mean.

    I can't see to wrap my head arround the meaning of this error. Its becouse im converting integer functions to character functions. src/dataio.cpp: In function ‘char* getName(char)’: src/dataio.cpp:118:17: error: invalid …
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in What does this error mean.

    The error means that the `readUser` function expects an argument of type `char*`, but you're giving it a `char`.
  • Member Avatar for sepp2k
    sepp2k

    Began Watching warning too many arguments for format ?

    here my script, please help me to resolve it :D thanks #include<stdio.h> #include<stdlib.h> #include<string.h> #include<float.h> int main() { /* KAMUS */ /* volume gas ideal = V=nRT/P -R= 8.314 P: …
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in warning too many arguments for format ?

    Your printf format strings don't include any specifiers (like `%s`, `%d`, `%f` etc.). So `printf` does not expect any arguments after the format string, but you do give arguments. These …
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in C++ Conjunction, Disjunction, and Implication

    'F' and 'T' are constants. Something like `if('F' && 'T')` will always be true. You could just as well write `if(true)`. As I said, what you want to do is …
  • Member Avatar for sepp2k
    sepp2k

    Began Watching Functors in Python

    Does anybody have a good example of a Functor in Python?
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in Functors in Python

    When you say "functor" are you using the term in the C++ sense (i.e. a callable object) or something else? And would a good example be the most simple one …
  • Member Avatar for sepp2k
    sepp2k

    Began Watching C++ Conjunction, Disjunction, and Implication

    Hello All! I am having trouble with my C++ code. The problem is that my code isn't giving me the correct logic outputs, Also, my teacher said to MUST MAKE …
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in C++ Conjunction, Disjunction, and Implication

    Your variables letter1 and letter2 will always contain the values 'P' and 'Q' respectively (using the given input file, I mean). So doing things like `if(letter1)` doesn't make sense. Inside …
  • Member Avatar for sepp2k
    sepp2k

    Began Watching Why do I need headers at all?

    I was just thinking that why I need headers at all? In headers, most oftenly we have the declarations only. In .cpp we have the definitons of that .h file. …
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in Why do I need headers at all?

    > But, why can't we write all the functions directly in .h file and include it in my project files? Because then linking would fail with a "multiple definitions" error …
  • Member Avatar for sepp2k
    sepp2k

    Began Watching Small program not compiling

    I'm reading 'C++ Programming in easy steps' and the program the book has given me will not compile. Compile line -> `g++ -g -Wall "${ARG}" -o "${ARG:: -4}" &&` ARG …
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in Small program not compiling

    `<string.h>` (also available as `<cstring>`) is a C header that declares functions that work on C strings (i.e. 0-terminated `char*`s). The `std::string` class is defined in `<string>`. You'll also need …
  • Member Avatar for sepp2k
    sepp2k

    Began Watching structures VS unions

    I'm reading my C++ book and I've come to a chapter on structures and unions. The book has tried to explain the difference but I'm not getting it's explanation. Playing …
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in structures VS unions

    > When you say 'member' are you refering to the, what would be an object if the structure were a class or something else? No, he's talking about what comes …
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in Difference

    > A standard compliant compiler must produce the same code in both cases. This is not even a matter of optimization, really, it's a matter of standard compliance. That's not …
  • Member Avatar for sepp2k
    sepp2k

    Began Watching Difference

    i want to know the differnce between int a=10 & int a; a=10; though both look same and assign the value 10 to the variable a. but in memory theres …
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in Difference

    Edit: Please ignore me.
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in Bitshift Operations?

    I assume it only looks at the last 5 bits of the right operand to `<<` and ignores anything else (presumably that's how it's implemented in the CPU). So 32 …
  • Member Avatar for sepp2k
    sepp2k

    Began Watching UnboundLocalError: local variable 'B' referenced before assignment

    Help! UnboundLocalError: local variable 'B' referenced before assignment. Thanks! if a >= 3: A = (3 ^(int(log((a/3), 2)* 3))) if b >= 3: B = (3 ^(int(log((b/3), 2)* 3))) if …
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in UnboundLocalError: local variable 'B' referenced before assignment

    If that's all your code, you never give a value to any of your lower-case variables.
  • Member Avatar for sepp2k
    sepp2k

    Began Watching Bitshift Operations?

    Hello there everybody.. I am just trying to understand something in relation to bitshift operations. With reference to the small program below. I have tried to keep this as simple …
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in Bitshift Operations?

    Shifting an `n`-bit integer by `m` bits when `m > n` invokes undefined behavior in C and C++. If you change your code like this, it will give you 0 …
  • Member Avatar for sepp2k
    sepp2k

    Began Watching Programming and C++

    Good day to all! I'm totally lost here. I am just beginning programming lessons by reading How to Design Programs and use Dr. Racket. I bump into C++ and got …
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in Programming and C++

    I haven't read How to Design Programs, so I don't know how good it is, but if you're having success so far, I'd say just stick with it. In my …
  • Member Avatar for sepp2k
    sepp2k

    Began Watching Difference between char* and char []

    Hi all, can someone help knowing the difference between char *st="myname"; char st[]="myname"; i know they both is array of charachers but the difference when dealing with them and how …
  • Member Avatar for sepp2k
    sepp2k

    Began Watching Multiple definition of 'main'

    My coding shows error when built and run. The error shows multiple definition of 'main'. Can someone help me what I did wrong here? #include <stdio.h> int main() { FILE …

The End.