I'm having problems with this code:
if ( choice== 1 )
printf( "--------------------------------------------------------------------------------\n");
printf( "You have now picked up the shiny gem, it's now in your bag.\nYou notice an entrance to a cave.");
if ( choice==2 )
printf( "--------------------------------------------------------------------------------\n");
printf( "You have just kicked the gem off the road.\n")
if ( choice==3 )
printf( "--------------------------------------------------------------------------------\n");
printf( "You have stomped the gem, it now appears to be broken.\n");
if ( choice== 1 )
printf( "--------------------------------------------------------------------------------\n");
printf( "You have now picked up the shiny gem, it's now in your bag.\nYou notice an entrance to a cave.");
if ( choice==2 )
printf( "--------------------------------------------------------------------------------\n");
printf( "You have just kicked the gem off the road.\n")
if ( choice==3 )
printf( "--------------------------------------------------------------------------------\n");
printf( "You have stomped the gem, it now appears to be broken.\n");
return 0;
}
POSSIBLY fixing code with CODE tags
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
if ( choice== 1 ) {
printf( "--------------------------------------------------------------------------------\n");
printf( "You have now picked up the shiny gem, it's now in your bag.\nYou notice an entrance to a cave.");
}if ( choice==2 ) {
printf( "--------------------------------------------------------------------------------\n");
printf( "You have just kicked the gem off the road.\n")
}if ( choice==3 ) {
printf( "--------------------------------------------------------------------------------\n");
printf( "You have stomped the gem, it now appears to be broken.\n");
}return 0;
}
And... Well "shorten" version of code (read: better writed... without tabs)... again with CODE tags
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
if ( choice== 1 ) {
printf( "--------------------------------------------------------------------------------\n");
printf( "You have now picked up the shiny gem, it's now in your bag.\nYou notice an entrance to a cave.");
} elseif ( choice==2 ) {
printf( "--------------------------------------------------------------------------------\n");
printf( "You have just kicked the gem off the road.\n")
} elseif ( choice==3 ) {
printf( "--------------------------------------------------------------------------------\n");
printf( "You have stomped the gem, it now appears to be broken.\n");
} else {
// Not a good choice
}
return 0;
}
hope this will help
And also....
Why you "print" same row of "--"'s instead printing them before if mess?