Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Code Style

Name: Anonymous 2010-01-24 16:09

The following program demonstrates your tab width, indentation style, and various other aspects of your code style. Please write it (in verbatim) in your preferred style. Remember to use spaces instead of tabs, as shitchan automatically converts tabs into 3 space characters.

[code]#include "stdio.h"

int main (void)
{   int   x;
    char  c = 'a';
    float y = 0;
   
    for (x = 0; x < 10; x++)
    {   if  (x % 2 == 0)
            printf ("%d\n", x);
        else
        {   printf ("%c\n", c);
            c +=1;
        }
    }
   
    return 0;
}

Name: Anonymous 2010-01-25 8:54


/* This is the main function. The main function will do
   everything in the program. */

int main (void)
{

  /* In this section rest the declarations
     for the variables used througout the program. */

  int x; /* This will be use for the counter. */
  char c;
  float y; /* ``float'' is a nice word. */

  /* Here we initialize the char (declared above)
     and the float. */

  c = 'a';
  y = 0;
  
  /* This section of the code loops from 0 to 9,
     and handles things differently depending on whether
     ``x'' divides by two. */

  for (x = 0; x < 10; x++) {  

    /* If-else clause. Handles what happens depending
       on the value of x. */

    /* If... */

    if  (x % 2 == 0)

      /* If x divides, it prints x, and a newline. */
      printf ("%d\n", x);

    /* Else... */

    else {

      /* If x does not divide, it prints ``c'', and a newline,
         and adds 1 to c. */

      printf ("%c\n", c);
      c = c + 1;
    }

  }
  
  /* This section returns ``0''. */

  return 0;

}

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List