Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdlib>
- #include <iostream>
- #include <string>
- using namespace std;
- template<class T>
- int IleWPrzedziale(T *tab,int n,T p1,T p2){
- int count =0;
- for(int i=0; i<n;i++){
- if(tab[i]>=p1 && tab[i]<=p2){
- count++;
- }
- }
- return count;
- }
- int main()
- {
- int tabInt[5]={1,2,3,4,5};
- int p1 = 2;
- int p2 = 4;
- cout<<"W przedziale jest : "<<IleWPrzedziale<int>(tabInt,5,p1,p2)<<" liczb"<<endl;
- int jednocyfrowe =0;
- int dwucyfrowe =0;
- int inne =0;
- int t1[200];
- for(int i=0;i<200;i++){
- t1[i]=i+1;
- }
- for(int i=0 ;i<200;i++){
- if(to_string( t1[i] ).lenght() == 1){
- jednocyfrowe++;
- }else if(to_string( t1[i] ).lenght() == 2){
- dwucyfrowe++;
- }else{
- inne++;
- }
- }
- cout<<"Licz jednocyfrowych: "<<jednocyfrowe<<" Dwucyfrowych: "<<dwucyfrowe<<" O wiekszej ilosci cyfr"<<inne<< endline;
- system("PAUSE");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement