grahp.c |
| /***************************************** * * * James Little 19/8/01 * * Simple Graphs * * * * * * * * * * * *****************************************/ #include <stdio.h> #include <stdlib.h> main(){ int graph_num = 0; char graph[20][20]; int cols; int rows; char symbol = '\0'; int x,y, buffer,i=0; int even = 2; while(scanf("%d %d\n", &rows, &cols) == 2 && rows+cols != 0){ graph_num++; printf("Graph %d\n", graph_num); for(x=0; x<rows; x++){ for(y=0; y<cols; y++){ graph[x][y] = ' '; } } while(1){ scanf("%c", &symbol); if(symbol == '#') break; while(scanf("%d %d ", &x, &y) == 2 && x+y != 0){ graph[x-1][y-1] = symbol; } } for(x=0; x<rows; x++){ for(y=0; y<cols; y++){ printf("%c", graph[x][y]); } printf("\n"); } printf("\n"); } return EXIT_SUCCESS; } |
James Little |