Program 6 - preprocessors#include #include...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
Sheet1 Page 1 // preprocessors #include <stdio.h> #include <stdlib.h> #define TRUE 1 #define FALSE 0 // function prototypes void contrast( int [][40] ) void copyBorder( int [][40], int [][40] ) int filter( int [][40], int i, int j ) void filterPixels( int [][40], int [][40] ) int loadPixelData( int [][40] ) int showMenu( int dataFlag, int filterFlag ) void showPixels( int [][40], int[][40], int choice ) /******************************************************************** * * This is main. It runs a while loop to know when to exit. It * calls functions based upon the user choice. * ********************************************************************/ int main(void) { // initialize variables int rawArray[15][40] = {{0}} int filterArray[15][40] = {{0}} int dataFlag = FALSE int filterFlag = FALSE int choice = 0 while ( choice != 6 ) // while choise isnt "exit" { choice = showMenu( dataFlag, filterFlag ) switch ( choice ) { case 1: // if choice 1 { dataFlag = loadPixelData ( rawArray ) break } case 2: // if choice 2
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Sheet1 Page 2 { if ( dataFlag == TRUE ) // only if data has been input { filterPixels( rawArray, filterArray ) filterFlag = TRUE break } } case 3: // if choice 3 { if ( dataFlag == TRUE ) // only if data input and pixels filtered { if ( filterFlag == TRUE ) { contrast( filterArray ) break } } } case 4: // if choice 4 { if ( dataFlag == TRUE ) // only if data input and pixels filtered { if ( filterFlag == TRUE ) { showPixels( rawArray, filterArray, choice ) break } } } case 5: // if choice 5 { if ( dataFlag == TRUE ) // only if data input { showPixels( rawArray, filterArray, choice ) break } } } } return TRUE } /******************************************************************** *
Background image of page 2
Sheet1 Page 3 * This is showMenu. It displays a menu and records the user's * choice. The menu displayed depends on if data has been input and * if it has been filtered. * ********************************************************************/ int showMenu( int dataFlag, int filterFlag ) { // initialize variables int choice = 0 if ( filterFlag ) // if data has been filtered { // display the full menu printf("\n*** Main Menu
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 09/15/2008 for the course CPT S 251 taught by Professor Warnick during the Spring '08 term at Washington State University .

Page1 / 20

Program 6 - preprocessors#include #include...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online