Suppose I know some indexes like 4, 7, 10,11, 13 and so on in sequence then I should put in dashes for the missing values like this:

- - - 4- - 7- - 10 11 - 13 etc

How do I program this? I know the indexes and the number of indexes.


Any help much appreciated

Thank you

Since you know the indexes, the number of indexes, and they are in sequence, all you have to do is,

// comment : Number of Indexes = N;
// comment : Index Array = Index[ N ];
Current_Index  = 0;
Loop_Counter = 0;
While Current_Index < N
        If Index[Current_Index] == Loop_Counter{
               Print Index[Current_Index];
               Current_Index = Current_Index + 1;               
        Else
               Print "-";
        Endif
        Loop_Counter = Loop_Counter + 1;
End While
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.