#include #include #include void showtable(int tablesize, int* table) { for (int i = 0; i < tablesize; i++) printf("+-----"); printf("+\n"); for (int i = 0; i < tablesize; i++) printf("| %3d ", table[i]); printf("|\n"); for (int i = 0; i < tablesize; i++) printf("+-----"); printf("+\n"); } void showtable2(int tablesize, int* table) { for (int i = 0; i < tablesize; i++) if (table[i] >= 0) printf("+-----"); printf("+\n"); for (int i = 0; i < tablesize; i++) if (table[i] >= 0) printf("| %3d ", table[i]); printf("|\n"); for (int i = 0; i < tablesize; i++) if (table[i] >= 0) printf("+-----"); printf("+\n"); } int main(int argc, char * argv[]) { int tab[10] = {}; srand(time(NULL)); int rand_v = rand(); for (int i = 0; i < 10; i++) { srand(rand_v); tab[i] = rand() % 101 > 50 ? (-rand() % 100) + 50: (rand() % 100) - 50; rand_v = rand(); } showtable(10, tab); printf("\n\n"); showtable2(10, tab); return EXIT_SUCCESS; }