Created
February 9, 2015 16:45
-
-
Save Marahin/7371f210e2dc60da4199 to your computer and use it in GitHub Desktop.
czarek
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <cstdio> | |
#include <ctime> | |
using namespace std; | |
int main(){ | |
/* ustawiamy, aby rand() zawsze generowal nowe liczby na podstawie czasu */ | |
srand( time( NULL ) ); | |
int tab[10][10],i=0,j=0,suma=0; | |
cout << "Generujemy liczby losowe i wypelniamy tablice" << endl; | |
for(i=0;i<10;i++){ | |
for(j=0;j<10;j++){ | |
/* generujemy liczby i wypelanimy nimi tablice */ | |
tab[i][j]=rand() % 100; | |
cout << tab[i][j] << " "; | |
} | |
cout << endl; | |
} | |
cout << "Sprawdzamy ile jest liczb dwucyfrowych." << endl; | |
for(int i=0; i<10; i++){ | |
for(int j=0; j < 10; j++){ | |
/* czy liczba jest z przedzialu <10, 99> */ | |
if(tab[i][j]>=10 && tab[i][j]<=99){ | |
suma++; | |
} | |
} | |
} | |
cout << "Ilosc liczb dwucyfrowych: " << suma<< endl; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment