0

cout<<"sal["<<i<<"] : "<<sum<<endl;

I din understand that why we are putting i square bracket.how it is working??? Arrays concept.

14th May 2020, 4:31 PM
pooja sharma
pooja sharma - avatar
2 Answers
+ 1
Well, it's not an array concept since the code above simply prints out the square brackets. here's how it executes: sal[I] : sum since you hadn't show the values of variable 'i' and 'sum' so I written the name of the variable instead writing the value of variable.
14th May 2020, 5:24 PM
Rellot's screwdriver
Rellot's screwdriver - avatar
0
Yes. To get the output like this, example : sal[0] : 1000 sal[1] : 2000 sal[2] : 3000 ... ... .. .. Everything you write in between "" (double quotes) is becomes a string...., so only there i and sum are variables, remaining are string only..
14th May 2020, 6:10 PM
Jayakrishna 🇼🇳