1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

Clarification

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

  1. bashamsc

    bashamsc New Member

    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

    Write it out the long way
    Code:
    cout << "a[" << i << "]"
    
     

Share This Page