0

I'm writing flowcharts in C. And I've come across with the printable value "C{0}\t". It's in the fifth box.

I got the flowchart from the internet. So I don't have means to ask the person who made it for additional information. I think that the flowchart is not intended to be used in a C programming class, but in another language, which I don't know.

Any idea what is the meaning? How could I translate it into C?

enter image description here

Do you know what language is? I can find also in the same exercise sheet things like these:

i<array.GetLength(1)

or

DisplayLastWithColSums(int[,] array)

Thanks in advance.


I coded the following solution:

void main ()
{
    int i = 0, j = 0, k = 0, col = 10;
    char sum_dashes[1000] ;

    printf("\n\t");

    while (i < col)
    {
        printf("C%i\t", i + 1);
        i++;

        while (j < 8)
        {
            sum_dashes[k] = '-';
            k++;
            j++;
        }

        j = 0;

    }

    printf("\n\t");
    for (i = 0; i < k; i++)
    {
        printf("%c", sum_dashes[i]);
    }


}

That prints out the next result:

    C1    C2    C3    C4    C5    C6
    ------------------------------------
carloswm85
  • 1,396
  • 13
  • 23
  • Flowcharts are "*languageless*" or at least they should be. I think you need to understand what a flowchart is before searching for one on the internet and "*translating*" it. – Iharob Al Asimi Feb 21 '18 at 16:05
  • 2
    Possibly C# where `"C{0}\t",i+1` is an output format mask and its interpolated value. – Alex K. Feb 21 '18 at 16:10
  • It's almost certainly some sort of typo. As such, it is nigh on impossible for us to determine what should be there. The context for the flowchart might disambiguate it, but otherwise, there's not much hope. It appears to be something to do with printing headings; it might be intended to be some sort of subscripted column name, but the dashes are peculiar (they normally need to be on the next line, not the same line, so the flowchart seems misguided on that score). Unless it is a classroom exercise, skip it and move onto another. If it is a classroom exercise, consult the teacher. – Jonathan Leffler Feb 21 '18 at 16:36
  • @JonathanLeffler the dashes get put out at the end in the “Sum” box. I think the idea is to draw a line across that is 8 dashes per column. – GrahamS Feb 21 '18 at 19:00
  • To me it is not clear what you are trying to accomplish here. If you are writing a random flowchart parser it might be a bit impractical to try to parse arbitrary text from arbitrary flowcharts around the net. The code below looks a bit like .Net but that's a guess. – Rolf Feb 21 '18 at 20:02
  • I have more flowcharts from the same exercise sheet. I think they are all related. Is it a good idea to add the previous and the next flowcharts to this one so you can have a better landscape of the exercise? I think that @GrahamS is likely pointing out the best possibility. The previous flowchart describes a program that makes a chart with not-fixed columns and rows. – carloswm85 Feb 22 '18 at 00:14
  • The answer to the meaning of "C{0}\t" can be found [here](https://stackoverflow.com/questions/530539/what-does-0-mean-when-found-in-a-string-in-c). I'll add what I could program using the hints you gave me guys to end of the initial question. I think I've solved it. Thanks for your help, guys. – carloswm85 Feb 22 '18 at 12:12

1 Answers1

0

I think {0} is intended as a placeholder for the 0th argument after the quotes. So..

"C{0}\t", i+1

Produces “C1” then “C2” then “C3” etc separated by tab characters (\t)

The equivalent in C would be:

printf("C%d\t", i+1);
GrahamS
  • 9,980
  • 9
  • 49
  • 63
  • Probably C1 is column 1, and so on. I think that the flowchart is showing how to add headers to a chart. I will try to make it work in C and I will let you know my results. Thanks, pal. – carloswm85 Feb 22 '18 at 00:17