Basically I'm trying to make this program so if you change the value of cupOfMarbles it will count up and print 5...6...7...8...9...10 and then stop (in this example) or if it is over 10 it will count down until the loop reaches 10. Nothing happens though, no errors on the compile either so my logic must be off or values aren't being passed. Any suggestions on what I need to do to fix this (without getting too complicated) I'm still learning
Thanks
Code:
#include <stdio.h>
void UnderTen( void ); // cupOfMarbles is under 10
void OverTen( void ); // cupOfMarbles is over 10
int cupOfMarbles;
int main (int argc, const char * argv[]) {
cupOfMarbles = 5; // change this value to get different results
if ( cupOfMarbles == 10 )
printf( "You already have 10 marbles in this cup!\n" );
if ( cupOfMarbles < 10 )
UnderTen();
if ( cupOfMarbles > 10 )
OverTen();
return 0;
}
void UnderTen( void ) {
int i;
for ( i = cupOfMarbles ; i == 10; i++ )
printf( " There are currently %d marbles in the cup!\n", i );
}
void OverTen( void ) {
int i;
for ( i = cupOfMarbles ; i == 10; i-- )
printf( "There are currently %d marbles in the cup!\n", i );
}