Karczu Posted April 1, 2012 Report Share Posted April 1, 2012 Mam pytanko. W poniższym programie wartości są losowane: #include <time.h> #include <stdlib.h> int main () { const int N = 15; srand ( time(NULL) ); int tab[N]; for(int i =0; i < N; i++) tab = rand() % 10 + 1; return 0; } Gdyby wartości nie miały być losowane, a pobierane przez Użytkownika, to kod wyglądałby tak: #include <time.h>#include <stdlib.h> int liczba; int main () { const int N = 15; int tab[N]; for(int i =0; i < N; i++) { cout << "Podaj liczbe:\n"; cin >> liczba; tab = liczba; } return 0; } Czy może inaczej? Z góry dzięki Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.