i am trying to eliminate zeros and have no duplicate numbers on each line. this is where i am at now with no success. any help will be appreciated. i dont want to use 'goto' .
thnx..
Code:#include <stdlib.h> #include <time.h> #include <iostream> using namespace std; int main() { srand((unsigned)time(NULL)); int number[10], i, j, k; for(j=1; j<10; j++){ for(i=0; i<10; i++){ number[i] = rand()%50; for(k=0; k<i; k++){ if(number[i] != number[k] && number[i] != '0') break; else if(number[i] == number[k] || number[i] == '0') number[i] = rand()%50; } cout << number[i] << ' '; } cout << '\n'; } return 0; }



LinkBack URL
About LinkBacks



You should be using ctime and cstdlib for C++.