Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int c(int * b1,int * b2 , int n1, int n2){
- int t=0;
- for(int a=0;a<n1;a++){
- t=t+b1[a];
- }
- for (int m=0;m<n2;m++){
- t=t+b2[m];
- }
- return t;
- }
- int main() {
- int n1;
- int n2;
- cout<<"Введите n1: ";
- cin>>n1;
- cout<<"Введите n2: ";
- cin>>n2;
- if(n1!=n2){
- cout<<"ОШИБКА!!!"<<endl;
- return 0;
- }
- int *b1 = new int[n1];
- int *b2 = new int[n2];
- cout<<"Введите b1: ";
- for(int i=0;i<n1;i++){
- cout <<"Ввод "<< i << " числа: ";
- cin>> b1[i];}
- cout<<"Введите b2: ";
- for(int i=0;i<n2;i++){
- cout <<"Ввод "<< i << " числа: ";
- cin>> b2[i];
- }
- cout<<endl<<"C: "<<c(b1,b2,n1,n2)<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement