Originally posted by Crimpy
I think the point of Prelude's post was that you're having problems because your design sucks. From what I've seen, he probably used the code he posted as an example of a good design, not what you need to do with your code.
First thing first...Crimply wimpy what ever ya name is read this STFU.. Read a post and try to understand it before awnsering...
Code:
#include <stdio.h>
#include <stdlib.h>
#define ROW 50
#define COL 50
static void cleararray(void);
static void Directions( int [] [COL], int, int, int );
static void printfloor( int [] [COL], int, int, int, int);
int main(int argc, char *argv[])
{
int floor[ROW][COL];
int i, j, rowpos, colpos, choose, pen_up_down;
for (i=0;i <=ROW-1;i++ ) /*Initialize arrays to zero*/
{
for (j=0;j<=COL-1;j++ )
floor[i][j]=0;
}
printf ("Turtle Graphics program(Logo programming)\n"
"Enter tne following command in integer\n"
"[1] Pen Up\n"
"[2] Pen Down\n"
"[3] Right\n"
"[4] Left\n"
"[5] (Enter # of spaces to move)\n"
"[6] Print the array\n"
"[9] End the programm\n");
scanf ("%d", &choose);
while (choose != 9)
{
switch (choose)
{
case 1:
pen_up_down = 0;
break;
case 2:
pen_up_down = 1;
break;
case 3:
Directions(floor[][COL], choose, i, j);
break;
case 4:
Directions(floor[][COL], choose,i, j);
break;
case 5:
printarray(floor[][COL],choose, pen_up_down, i, j);
break;
case 6:
for (i=0;i <= ROW-1;i++ )
{
for (j=0;j<= COL-1; j++ )
floor[i][j]=0;
}
case 9:
break;
default:
printf ("Invalid command.Please Enter again");
break;
}
printf ("Enter command: ");
scanf("%d", &choose );
}
system("pause");
return 0;
}
void Directions ( int a[][], ch, cnt, cnt1 )
{
int count, count1;
cnt =0;
cnt1 = 0;
switch (ch)
{
case 3:
for (count = cnt; count <= cnt; count++, cnt++)
{
for (count1 = cnt1; count <= cnt1; count++)
{
a[count][count1];
}
}
case 4:
for (count= cnt;count <=cnt; count++ )
{
for (count1 = cnt1;count1 <= cnt1; count1++, cnt1++ )
{
a[count][count1];
}
}
}
void printarray ( int array[][], cho, pen, x, y );
{
Well hammer no that not what i wanna do ....
here is the link http://cboard.cprogramming.com/showt...urtle+graphics
Well prelude stuff was not what i needed so it dint help a bit ..but still his code dint go in a wast ... i learned some new stuff from it ..The code above is just an example if i should continue
if not i better sit my ass down and think properly well i mostly program at night times so its really a stress....
If my code suck let me know so i can go through it properly ...