-
December 2nd, 2011, 11:00 PM
#1
Coding Arrays
Hey guys, my name is robyn and i am new to this site! i am having a bit of trouble coding arrays in c++. I know the basics an array, but am a little unexperienced when it comes to actually coding them. My teacher assigned us this problem:
int x[5], y[5], n[5] = {1,2,3,4,5};
Write a program that creates two new arrays. The first new array will square the elements of the original array. The second new array will be the sum of the corresponding array elements of the first two arrays. Here is what your output should look like:
Number Square Sum
1 1 2
2 4 6
3 9 12
4 16 20
5 25 30
If anyone can help me out a little, it would be sosoooo appreciated.
xoxo
Robyn
PS. If i get an A on this assignment i wouldn't be opposed to posting some hot pix of me
-
December 3rd, 2011, 07:10 AM
#2
Re: Coding Arrays
Originally Posted by xxrobynxx
... i am having a bit of trouble coding arrays in c++.
...
If anyone can help me out a little, it would be sosoooo appreciated.
There are many people here that are ready to help you. But no one will make your homework for you!
What problem do you have? Don't you know how to create a simple C++ program?
Don't you know how to program in C some trivial arithmetic operations like addition and multiplication?
Victor Nijegorodov
-
December 3rd, 2011, 03:27 PM
#3
Re: Coding Arrays
for 1st array
you have to power to 2 element by element and this can be done by loop "for" this easy you just have to figure when to start and stop the loop what will be increased every time
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|