Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- bool CzySaTakieSame(int* tab,int* tab2,int n){
- int licznik=0;
- for(int i=0;i<n;i++){
- if(tab[i]==tab2[i])licznik++;
- }
- if(licznik==10){
- return true;
- }else return false;
- }
- void wyswietl(int* tab,int* tab2,int n){
- cout<<endl;
- for(int i=0;i<n;i++){
- if(tab[i]!=tab2[i]){
- cout<<"["<< tab2[i]<<"] ";
- }else cout << tab2[i]<<" ";
- }
- }
- void wyswietl2(int* tab,int* tab2,int n){
- cout<<endl;
- for(int i=0;i<n;i++){
- if(tab[i]!=tab2[i]){
- cout<<"["<< tab[i]<<"] ";
- }else cout << tab[i]<<" ";
- }
- }
- int main()
- {
- int n = 10;
- int tab[n] = {0,2,3,4,5,6,7,8,9,10};
- int tab2[n] = {0,2,3,4,5,6,7,8,9,10};
- if(CzySaTakieSame(tab,tab2,n)==true){
- cout << "tab i tab2 sa takie same:\n";
- cout << "oto tablice:\n";
- int i = 0;
- do{
- cout<<tab[i]<<" ";
- i++;
- }while(i<n);
- cout<<endl;
- i=0;
- do{
- cout<<tab2[i]<<" ";
- i++;
- }while(i<n);
- }else{
- cout << "tab i tab2 sa nierowne!\n";
- cout << "oto tablice:\n";
- wyswietl2(tab,tab2,n);
- wyswietl(tab,tab2,n);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement