Clarification

Discussion in 'C++' started by bashamsc, Dec 17, 2007.

  1. bashamsc

    bashamsc New Member

    Joined:
    May 22, 2007
    Messages:
    51
    Likes Received:
    7
    Trophy Points:
    0
    Location:
    chennai
    In C programs we print array elements like

    printf("Elements of array a[%d] = %d",i,a);

    I want to know how print like above mentioned type in cpp.

    Because this type will not work in cpp.

    cout<<"a[%d] "<<i<<a; This will not work to print like in c.

    Then any other way is there.
     
  2. Salem

    Salem New Member

    Joined:
    Nov 15, 2007
    Messages:
    133
    Likes Received:
    5
    Trophy Points:
    0
    Occupation:
    Please don't PM me for 1:1 support.
    Write it out the long way
    Code:
    cout << "a[" << i << "]"
    
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice