Need Help with my Array Program (Probs easy for you advanced programmers)
Hey guys firstly, sorry that the comments in the Program are in german, but they are for a homework for my uni course and I have to explain what I do, I am certain most of you more advanced programmers will easily see what I have done. My Excercise was to program something that reads a starting number, then as many new numbers as the size of the original starting Number . (First input 20, it will then make you input 20 new numbers so to say) Output of the code was supposed to be the Plateau with the longest equal following Numbers, f,e: Input : 7,7,7,7,3,3,2,2,2,1,5 Output: 4, because the number chain of the 4 7'eners is the longest chain My Problem is it only works if I type in like: 4 and then type in 4 numbers with just one chain, it will tell me how long that chain is, which is what I want of course. However, and this is the problem, if I type in like 6 and then 3,3,3,2,2,1, it will output the longest chain is 4 because it just counts +1 to the highscore int that is counting how long simply all chains are together . Can someone explain to me how to code it so it knows when a new chain should be "memorized" that is not the same as the old chain? (And then also make it output the length of only the longest chain?) Huge thanks in advance to anyone that can help me!!! I dont know how to put my code here guys, can someone tell me ? :(