Search Results

Search found 12674 results on 507 pages for 'programming competitions'.

Page 198/507 | < Previous Page | 194 195 196 197 198 199 200 201 202 203 204 205  | Next Page >

  • Problem with "not declared in this scope" error

    - by lego69
    I've got: error a1 was not declared in this scope Can somebody please explain why this code causes that? quiz.h #ifndef QUIZ_H_ #define QUIZ_H_ #include "quiz.cpp" class A { private: int player; public: A(int initPlayer); ~A(); void foo(); }; #endif /* QUIZ_H_ */ quiz.cpp #include "quiz.h" #include <iostream> using std::cout; using std::endl; A::A(int initPlayer = 0){ player = initPlayer; } A::~A(){ } void A::foo(){ cout << player; } main function #include "quiz.h" int main() { quiz(7); return 0; } quiz function #include "quiz.h" void quiz(int i) { A a1(i); a1.foo(); }

    Read the article

  • How does ruby allow a method and a Class with the same name?

    - by Daniel Beardsley
    I happened to be working on a Singleton class in ruby and just remembered the way it works in factory_girl. They worked it out so you can use both the long way Factory.create(...) and the short way Factory(...) I thought about it and was curious to see how they made the class Factory also behave like a method. They simply used Factory twice like so: def Factory (args) ... end class Factory ... end My Question is: How does ruby accomplish this? and Is there danger in using this seemingly quirky pattern?

    Read the article

  • Why would Mathematica break normal scoping rules in Module?

    - by Davorak
    As was pointed out in a recent post scoping does not work as expected inside of Module. An example from that thread is: Module[{expr}, expr = 2 z; f[z_] = expr; f[7]] (*2 z$1776*) But the following works as almost as expected. Module[{expr}, expr = 2 z; Set@@{f[z_], expr}; f[7]] (*14*) What language design consideration made wolfram choose this functionality?

    Read the article

  • Why fork() before setsid()

    - by corentin.kerisit
    Why fork() before setsid() to daemonize a process ? Basically, if I want to detach a process from its controlling terminal and make it a process group leader : I use setsid(). Doing this without forking before doesn't work. Why ? Thanks :)

    Read the article

  • Offer access to a private page without login

    - by dccarmo
    So I've been struggling with a nice and easy way to allow users to access a private page without asking them to fill out a login/password form. What I'm thinking about using right now is for each private page I generate a uniqueid (using php uniqid function) and then send the URI to the user. He would access his private page as "www.mywebsite.com/private_page/13ffa2c4a". I think it's relatively safe and user friendly, without asking too much of information. I thought maybe when the user access this page it would ask for it's e-mail just to be sure, but the best would be nothing at all. Is this really safe? I mean not internet banking safe, but enough for a simple access? Do you think there's a better solution? Thanks. :)

    Read the article

  • Reading file into array

    - by Asmsycool
    Hello, I have these a file in a c program which consist of a string and 4 doubles and 2 integer in one line and there is a total of 28 lines, i want to read this file and load the data into an array. can someone help me solve this.

    Read the article

  • question about copy constructor

    - by lego69
    I have this class: class A { private: int player; public: A(int initPlayer = 0); A(const A&); A& operator=(const A&); ~A(); void foo() const; }; and I have function which contains this row: A *pa1 = new A(a2); can somebody please explain what exactly is going on, when I call A(a2) compiler calls copy constructor or constructor, thanks in advance

    Read the article

  • How can I bind the second argument in a function but not the first (in an elegant way)?

    - by Frank Osterfeld
    Is there a way in Haskell to bind the second argument but not the first of a function without using lambda functions or defining another "local" function? Example. I have a binary function like: sub :: Int -> Int -> Int sub x y = x - y Now if I want to bind the first argument, I can do so easily using (sub someExpression): mapSubFrom5 x = map (sub 5) x *Main> mapSubFrom5 [1,2,3,4,5] [4,3,2,1,0] That works fine if I want to bind the first n arguments without "gap". If I want to bind the second argument but not the first, the two options I am aware of are more verbose: Either via another, local, function: mapSub5 x = map sub5 x where sub5 x = sub x 5 *Main> mapSub5 [1,2,3,4,5] [-4,-3,-2,-1,0] Or using lambda: mapSub5 x = map (\x -> sub x 5) x While both are working fine, I like the elegance of "sub 5" and wonder if there is a similarly elegant way to bind the n-th (n 1) argument of a function?

    Read the article

  • transferring parameters in C++

    - by lego69
    hello, can I have this snippet of the code: C *pa1 = new C(c2); and I transfer it to another function: foo(pa1); what exactly do I transfer actual pointer or its copy, thanks in advance and can somebody give some info about in which cases info is copied, and in which I transfer actual pointer

    Read the article

  • Is it faster to count down that it is to count up?

    - by Bob
    Our computer science teacher once said that for some reason it is more efficient to count down that count up. For example if you need to use a FOR loop and the loop index is not used somewhere (like printing a line of N * to the screen) I mean that code like this : for (i=N; i>=0; i--) putchar('*'); is better than: for (i=0; i<N; i++) putchar('*'); Is it really true? and if so does anyone know why?

    Read the article

  • c++ possible errors

    - by lego69
    hello I've got error a1 was not declared in this scope, can somebody please explain me my fault my header: #ifndef QUIZ_H_ #define QUIZ_H_ #include "quiz.cpp" class A { private: int player; public: A(int initPlayer); ~A(); void foo(); }; #endif /* QUIZ_H_ */ implementation of class functions: #include "quiz.h" #include <iostream> using std::cout; using std::endl; A::A(int initPlayer = 0){ player = initPlayer; } A::~A(){ } void A::foo(){ cout << player; } my main #include "quiz.h" int main() { quiz(7); return 0; } function quiz: #include "quiz.h" void quiz(int i) { A a1(i); a1.foo(); }

    Read the article

  • Analyzing BSOD without a dump

    - by eeoo2555
    One of the drivers I'm developing has caused a BSOD. Unfortunately a dump file was not created since it was not configured / low resources. I was trying to reproduce this crash but no luck so far. Is there any way to get some info using WinDbg or any other tool? I have this information: A screenshot of the BSOD The .sys file. Its pdb The source code The machine it was crashed on I have everything except the dump itself. Your help will be much appreciated. As I said above, no dump (/minidump) exists. This is the actual problem. For this specific crash, I know I won't be able to get the stack. Just getting the specific line of code will be good enough. Because the BSOD contains the module's address, it seems like there should be a way to detect which line exactly is it. As I mentioned above, I do have the .sys file, the pdb and the source code. This is the specific code taken from MSDN: SYSTEM_SERVICE_EXCEPTION. How can I know from there what was the specific line? and/or the specific exception raised?

    Read the article

  • Pin Control in HCS12

    - by Brian Lindsey
    A HCS12 microcontroller I had to buy for a class I had recently taken has 40 pins on the back side of it. The class was merely about computer organization, and so unfortunately, we never had a chance to cover all the capabilities of the chip itself. Now that the class is over, I have been thinking about using the to familiarize myself with the assembly language. I haven't found any sources that cover pin control and was wondering if anyone could possibly provide me with a hands-on pin tutorial.

    Read the article

< Previous Page | 194 195 196 197 198 199 200 201 202 203 204 205  | Next Page >