Answered Questions

  • Constructor initialization lists

    What is advantage of using Constructor initialization lists?

    abc

    • Feb 5th, 2012

    --> initializer list is used with constructor when any const datas are used in a class. --> bcoz, as we known const var should be initialized while declaring. --> the class gets memory allocatio...

  • inline functions advantages

    what is the inline function and what is the use of inline function?

    Amit

    • Jan 6th, 2012

    Inline function: they are same as Normal function but compiler treat them diffrently. When we call a inline function compiler will replace the call by inline function body (It depends upon how you hav...

  • Write a simple program for finding factorial in C++ ?

    sakshi

    • Oct 4th, 2012

    Code
    1. class factorial
    2. {
    3. public static void main(String args[])
    4. int f=1,i,n;
    5. n=Convert.ToInt32(Console.ReadLine());
    6. for(i=1;i<=n;i++)
    7. {
    8. f=f*i;
    9. }
    10. Console.WriteLine("factorial of the no :"+f);
    11.  
    12. Console.ReadKey();
    13. }

    Anugya Singh

    • Sep 4th, 2012

    Code
    1. #include<iostream.h>
    2. #include<conio.h>
    3. void main()
    4. {
    5. clrscr();
    6. int a,i,f=1;
    7. cout<<"Enter the Number whose factorial value is to be find
    8. ";
    9. cin>>a;
    10. for(i=a;i>0;i--)
    11. {
    12. f=f*i;
    13. }
    14. cout<<"Fctorial is "<<f;
    15. getch();
    16. }

  • C/C++ black screen opens and closes

    While executing a program in C++, it happens the black screen opens and closes automatically without displaying the output(program is correct). How to recover from this situation?

    Amit

    • Jun 27th, 2014

    Use getchar() before return in the main.

    sebius

    • Aug 25th, 2013

    Try this

    Code
    1. system("pause");

  • Classes

    The copy constructor of class Money is called in which of the following cases?Choose one answer. a. Money amount1;Money amount2(amount 1); b. void func(Money amount);[...]Money amount1;[...]func(amount1); c. Money func();[...]Money amount1 = func(); d. all of the above

    jaroo

    • Oct 2nd, 2011

    The correct answwer is:

    "D. all of the above"

  • Bottom-Up Approach

    Why we follow top down approach in C-language and bottom up approach in C++?Explain in detail.

    random viewer

    • Jun 11th, 2012

    The question is wrong. In most cases, regardless of the language, top down is the better approach. Actually TDD forces this. You must first know what you want, that is, how the client code will use it, before you can design it. Always top down. Just remember that.