If you're going to post "demo/example" code then please observe the following:
1. Use sensible variable names, not a, k, p, n11. This is so the code can be easily understood by others. Obviously YOU know what a,k,p etc mean but it's not so obvious for the rest of us.
2. Write sensible comments throughout the code. This is so that someone reading the code can work out what each section of code is doing.
Here's an example of a pointless comment:
i++; // increment i
We know i++ increments i; this doesn't need commenting. The "increment i" comment adds nothing to the reader's understanding. Here's an example of a good comment:
// Calculate the average (avg) of the stats array
int total=0, avg=0;
for (int i=0; i<STATS_SIZE; i++)
3. Use correct formatting. The following is WRONG because it implies sz--; is part of the loop:
and this should of course be:
This also places braces on a line by themselves. Remember what you're trying to do here is to communicate clear program code, not to win any prizes for terseness and compactness, and this means spreading stuff out a bit. Please don't interpret that as "you have to double space everything", because too much space can make stuff just as hard to read as too little.
4. In your comments please use correct English. So the following is WRONG because it uses txtspeak:
so just enter ur first name
n den ur partner's name
and see the result
Look, writing "your" instead of "ur" is only two more letters. Further, you have a QWERTY keyboard presumably and aren't typing this lot in on a mobile phone. Better:
So enter your first name and your partner's first name, then the result will be displayed.
The idea is that the reader will be able to understand what you're saying without having to decode it first. If they have to try to work out what you're prattling on about then this introduces ambiguity that makes it harder to understand.
5. Be aware of letters that look like numbers. What's j counting up to: eleven, or LL, or L-one, or something else?
But with sensible names this isn't too problematical: