Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #define MAX 25
- #define maxArrayLength 26
- int main(int argc, char * argv[]){
- //Stage 1 Variables
- int time = 0;
- int edge;
- //int m;
- int matrix[MAX][MAX];
- int i,j;
- int timeStep = 0; //change names
- int windDirection; //change names
- int c = 0; //change name
- //int a = 0;
- char alpha[] = {"abcdefghiklmnopqrstuvwxy"};
- //char alpha[25] = {'a','b','c','d','e','f','g','h','i','j','k','l','m'
- //,'n','o','p','q','r','s','t','u','v','w','x','y'};
- //int numbers [] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,
- //20,21,22,23,24};
- printf("Enter t : ");
- scanf("%d",&time);
- if (time < 0 || time > 1000) {
- printf("Incorrect Input: t must be 0..1000\n");
- } printf("Enter n : ");
- scanf("%d", &edge);
- if (edge < 3 || edge > 25) {
- printf("Incorrect Input: n must be 3..25\n");
- }
- printf("Enter %d by %d forest :\n", edge, edge);
- for(i = 0; i < edge; i++){
- for(j = 0; j < edge; j++){
- scanf("%d",&matrix[i][j]);
- }
- }
- printf("Enter wind direction information :\n");
- scanf("%d %d", &timeStep, &windDirection);
- //get it to scan in numbers till a letter and every second number
- //starting from fisrt is timestep, then every second one starting from
- //the 2nd is direction.
- //Stage 1
- printf("Time step %d: Wind ", timeStep);
- if(windDirection==0){
- printf("NORTH\n");
- } else if (windDirection==1){
- printf("EAST\n");
- } else if (windDirection==2){
- printf("SOUTH\n");
- } else if (windDirection==3){
- printf("WEST\n");
- }
- //print the length of string, i.e. 5 is e
- //for (alpha=0; alpha < edge; alpha++);//print edge length + 2
- int counter = 0;
- while (counter < edge) {
- int x = 0;
- x = (edge % 25);
- printf ("%c", alpha[x]);
- }
- for(i=0; i < edge; i++){
- printf("# "); //left side
- for(j=0; j < edge; j++){
- if(matrix[i][j] == 0){
- printf(". ");
- }else if(matrix[i][j] == 1){
- printf("^ ");
- }else{
- printf("* ");
- }
- }
- printf("#\n");
- }
- printf("# # # # #\n"); //print edge length + 2
- printf("Number of cells containing trees in initial forest = %d\n", c); //count the number of ones
- printf("Number of cells that have burned down = 0\n"); //first stage
- printf("Percentage of forest burned down = 0.00\n"); //number of . /
- return 0;
- }
Add Comment
Please, Sign In to add comment