0

Before I start, I would like to stay thanks to the people who helped before in my previous threads. Sorry if I can't reply quickly at that time due to connection issues.

Back to the problem. I am working on a stemplot(http://en.wikipedia.org/wiki/Stem_and_leaf_plot), which prints the data(the plot thing) into the text file. The data is pre-sorted, and the numbers were obtained using RNG, but what I'm having trouble is how to place each of them into their respective intervals.

Here's the code:

```
//////////////////////////////////////////////
fp=fopen("plot.txt","r");
putchar('\n');
for(x=0;x<20;x++){
fscanf(fp,"%d",&storage[x]);
}
fclose(fp);
//Arranged data will be placed into their respective rows in descending order.
for(x=0;x<20;x++){
}
//Prints the data into a text file.
fp=fopen("plot.txt","w");
printf("Stem-and-leaf plot:\n\n");
fprintf(fp,"Stem-and-leaf plot:\n\n");
for(x=0;x<10;x++){
printf("%2d| ",9-x);
fprintf(fp,"%2d| ",(9-x));
for(y=0;y<10;y++){
if(storage[x]){
}
plot[x][y]=storage[x];
printf("%2d ",plot[x][y]);
fprintf(fp,"%2d ",plot[x][y]);
}
putchar('\n');
fputc('\n',fp);
}
fclose(fp);
}
```

I've already placed an "if" statement inside the plot's loop. But when I did it, it only prints the first ten data in the list. Any advice???

This is the output, without the if statement in.:

```
Stem-and-leaf plot:
9| 97 97 97 97 97 97 97 97 97 97
8| 96 96 96 96 96 96 96 96 96 96
7| 86 86 86 86 86 86 86 86 86 86
6| 82 82 82 82 82 82 82 82 82 82
5| 76 76 76 76 76 76 76 76 76 76
4| 68 68 68 68 68 68 68 68 68 68
3| 54 54 54 54 54 54 54 54 54 54
2| 53 53 53 53 53 53 53 53 53 53
1| 52 52 52 52 52 52 52 52 52 52
0| 49 49 49 49 49 49 49 49 49 49
```