Erm, I'm having trouble reading that so I'm going to try and repost the code using the code tags, and I'll tidy it up a bit too...
Right, now I'm gonna have a look at it, I'm not sure if that's how you meant the code to be (I think there may be some {} brackets missing, and I took out any that looked unecessary.Code:#include <iostream.h> #include <stdlib.h> #include <time.h> int *my (int *ta, int an) { int *temp; temp = talen; for (int i=0;i<an;i++) { if (ta < temp) temp = ta; ta++; } return (temp); } int main() { int ta[10]; int *sv; srand ((unsigned) time(NULL) ); ta[0]=rand(); for (int i=0; i<10; i++) cout<<rand()<<endl; cout << ta [0]<< " "; cout << endl; sv = my(ta, sizeof(ta) /sizeof(ta[0])); cout<< " Smallest numbers is: " << *sv << endl << endl; cout <<"\nPress any key to continue\n"; getch(); return(0); }




Reply With Quote