Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <ctime>
- #include <cstdlib>
- using namespace std;
- int main () {
- int i, j,a ;
- int wybor;
- int tab[3][5];
- srand(time(0));
- cout<<"1. Wypelnienie tablicy dwuwymiarowej losowymi liczbami."<<endl;
- cout<<"2. Wypelnienie tablicy dwuwymiarowej wpisujac recznie."<<endl;
- cout<<"3. Wyjscie z programu."<<endl;
- cout<<endl<<"Wybierz dzialanie: ";
- cin>>wybor;
- switch (wybor) {
- case 1:
- for(int i=0;i<3;i++) {
- for(int j=0;j<5;j++) {
- tab[i][j] = rand()%10;
- }
- }
- for(int i=0;i<3;i++) {
- cout<<" "<<endl;
- for(int j=0;j<5;j++) {
- cout<<tab[i][j];
- }
- }
- break;
- case 2:
- for(int i=0;i<3;i++)
- for(int j=0;j<5;j++) {
- cout<<"Podaj wartosc do tablicy: ";
- cin>>a;
- tab[i][j] = a;
- }
- for(int i=0;i<3;i++) {
- cout<<" "<<endl;
- for(int j=0;j<5;j++) {
- cout<<tab[i][j];
- }
- }
- break;
- case 3:
- cout<<endl<<"Wychodzenie z programu...";
- break;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment