Go4Expert (http://www.go4expert.com/)
-   C++ (http://www.go4expert.com/forums/cpp/)
-   -   Clarification (http://www.go4expert.com/forums/clarification-t7883/)

bashamsc 17Dec2007 10:31

In C programs we print array elements like

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

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[i]; This will not work to print like in c.

Then any other way is there.

Salem 17Dec2007 14:55

Re: Clarification
Write it out the long way

cout << "a[" << i << "]"

All times are GMT +5.5. The time now is 19:05.