1-rasm. MAC tizimlari
#include
#include
#include
intmain()
{
std::string str ="Meet the new boss...";
std::hashhash_fn;
size_tstr_hash=hash_fn(str);
std::cout<\n';
}
Natija:
391070135
#include
#include
#include
struct S {
std::stringfirst_name;
std::stringlast_name;
};
namespace std {
template<>
class hash{
public:
size_toperator()(const S &s)const
{
size_t h1 =std::hash()(s.first_name);
size_t h2 =std::hash()(s.last_name);
return h1 ^( h2 <<1);
}
};
}
intmain()
{
S s;
s.first_name="Bender";
s.last_name="Rodriguez";
std::hashhash_fn;
std::cout<<"hash(s) = "<\n";
}
Natija:
hash(s) = 32902390710
3Manfiy va musbat sonlardan 2 ta ro’yxat hosil qilib, chop eting .
#include
using namespace std;
int main(){
int a[1000],n;
cout<<"sonini kiritisng\n";
cin>>n;
cout<<"sonlarni kiriting\n";
for(int i=0;i
cin>>a[i];
}
cout<<"1-ro'yhat musbat sonlar\n";
for(int i=0;i
if(a[i]>0) cout<
}
cout<<"2-ro'yxat manfiy sonlar\n";
for(int i=0;i
if(a[i]<0) cout<
}
}
Do'stlaringiz bilan baham: |