So this program is suppose to allow the user to enter a 5 digit number. I store that as a string to test it. The program also allows the user to enter how many different 5 digit values he/she wants to enter. I then display the digits individually with its square and cube. The program works fine first time around, until the second loop it starts displaying weird results. I'd really appreciate it if someone could give me guidance to what I did wrong. The code looked fine to me. Thanks!
What is line 25 trying to do? It looks like it is trying to subtract a literal char from a item in a string array. This is a no no.
You increament trials2 in line 28 but then reset it to zero on line 21 when the loop comes back around? I don't get it.
Are you declaring 'trials' twice? Once on line 11 then again on line 17?
I'm surprized this compiled at all, your compiler should have caught that last one.
Change 'value' from a string type to a straight int array and that might help you a bit. You will need to change the way you feed them into that array as well.
The 'i' integer isn't used to control the loop in any way, if anything it's redundant he should just be using the 'trials' variable he set up earlier. Is there an internal loop I am missing somewhere? You two are making me feel a little dumb and this isn't even my program. Why didn't either of you address the fact that the OP is trying to use strings and chars for math operations? Even if this is allowed it's bad practice.
Never mind I see why he used the i integer, he still needs another loop to iterate through each array though
Thank you all so much! I forgot to set i back to zero. Yea, sorry my code is so messy, I'm just started learning C++. I'll definitely edit the code and make it more neat. Thanks a lot again!