Coding Challenge- Instruction for Newbie RRS feed

  • Question

  • I had a Live chat..

    and they said that we don`t hav to use cin for input. That means we hav to hardcode the problem.

    This is wat the sample they hav given to me.

    #include "Addition.h"
    int getAddition(int a, int b)
    return (a+b);
    void dsmain()
    int a = 10;
    int b = 7;
    int add = getAddition(a, b);
    printf ("\n\n Value : %d",add);


    They also said that STL is allowed..


    also all those who have already taken the 1st challenge plzzz do reply whether u had gone through this way

    or had used cin..

    also i want to know that whether the function declared need to be defined in header file or main file for c++..

    I forgot to ask this one.


    Saturday, September 22, 2007 4:17 AM

All replies


    Have u given the "mock test" for the coding challenge??.....if not, i wud suggest doin dat b4 going for the actual test....because the mock test will clear most of your doubts regarding the coding challenge. Also they have the list of basic "do's and dont's" which contains everythin we need to know. Besides that, we have to program just like we normally do for our regular problems. The only differences, are the one's they have specified in the "do's and dont's" list.



    Saturday, September 22, 2007 4:52 AM

    And yes, u r rite, we cant use dynamic variables, i.e. we cant use scanf(), getch(), etc etc......we have to specify the values of the variables in the program itself.....and also the functions declared have to be declared as header files.....
    Saturday, September 22, 2007 4:54 AM
  •  there is no need for t functions declared to b defined in t header file...

    Sunday, September 23, 2007 6:46 AM
  • Hey man the functions declared in the header file are necessary for us to implement. infact that is what we have to code. void dsmain() is not much important, the admins will not check our void main code, infact they will cann OUR IMPLEMENTED functions from their script, and check with the actual values, if it matches, then marks will be given.

    So make sure you INCLUDE the .h file, and also do implement the function.
    Now you guys may ask "why cant we directly code the function to the main .c/.cpp file". You guys might have noticed a #define C_OR_CPP  declaration, thats used to determine whether the code written by us is in C, or CPP
    and we have to follow the same standard of the function / class defined in our .c/.cpp file.

    I hope you understand now.
    Sunday, September 23, 2007 7:20 AM
  • Also there are confusions sometimes, because in do and dont's they have mentioned to comment out the main function and then compile and send the asnwer.. where as some times the person in live chat says that we dont have to comment out the main....

    I think that we have to comment out the main, the logic is that our function is to be tested, so the object file created of our function will be linked with their main module and then tested,.... so it becomes logical...

    But if we dont comment out the main() then it will be a cumbersome task for them....
    Still things are not so clear... So i ask them to please make the things very clear about the commenting out of the main()

    Monday, September 24, 2007 4:13 AM
  • wat do u meant by 'comment out the main'....


    Monday, September 24, 2007 4:53 AM
  • Comment out means, either remove the main() from the code or put it in comments.. just compile the code with only fucntion, so it becomes easy to link it with other module with main() which will call the function in our code....

    People who have not studied linker and assembler will find it difficult to understand at this moment, but others should get a hint...
    Monday, September 24, 2007 4:57 AM