Question

in c++ Write a program which can add two float vectors (arrays) of any length ?....

in c++ Write a program which can add two float vectors (arrays) of any length ?. The length ? of the two
vectors being added should be the same. The user will enter the length ?. Use the length to control
how many times you loop. The result is also a vector.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

`Hey,

Note: Brother if you have any queries related the answer please do comment. I would be very happy to resolve all your queries.

#include <iostream>

using namespace std;

int main()
{
int n;
cout<<"Enter n: ";
cin>>n;
int v1[n],v2[n];
cout<<"Enter vector v1: ";
for(int i=0;i<n;i++)
{
cin>>v1[i];
}
cout<<"Enter vector v2: ";
for(int i=0;i<n;i++)
{
cin>>v2[i];
}
cout<<"The added vector is: ";
for(int i=0;i<n;i++)
{
cout<<(v1[i]+v2[i])<<" ";
}
cout<<endl;

return 0;
}

Kindly revert for any queries

Thanks.

Add a comment
Know the answer?
Add Answer to:
in c++ Write a program which can add two float vectors (arrays) of any length ?....
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
Active Questions
ADVERTISEMENT