Okay, okay...I tried to write the code myself...I figured someone would be cool enough to do me a favor, but I guess there's some moral programming "code" I am unaware of. Anyway, here's what I have. Please judge and modify and add and erase to your hearts content.
Code:#include <stdio.h> #include <time.h> #include <stdlib.h> void doOneSet(char opc) { char str[100] = { 0 }; switch(opc) { int i; case '+': for(i=0; i < 5; i++){ sprintf(str, "%2d + %2d = ", rand() % 100, rand() % 100); puts(str); } break; } } int main(void) { srand((unsigned)time(NULL)); doOneSet('+'); return 0; } switch(opc){ int i, n1, n2; case '+': for(i=0; i < 5; i++){ n1 = rand() % 100; n2 = rand() % 100; sprintf(str, "%2d + %2d = %3d", n1, n2, n1 + n2); puts(str); } break; }



LinkBack URL
About LinkBacks





.