### field

We have 2 fields - 6 numbers. Summing up homotopy elements and stores them in the third field.

2 5------> 7
3 5------>8
4 11------>15

what are homotopy elements?
the number which are in the same position
Could you show the part of your code that you have problems with?
 ``1234567891011121314151617181920212223242526272829303132333435`` ``````#include // vhodno-izhodni ukazi #include //standardni ukazi #include // za la?je delo z nizi, veljavno le v C++ in ne v C# #include using namespace std; int main() { int polje1[6]; int polje2[6]; int polje_vsot[6]; cout<<"Vnesite elemente prvega polja: "<>polje1[i]; cout<<"Vnesite elemente drugega polja: "<>polje2[i]; short rezultat; //Sestevanje istoleÅ¾nih elementov v obeh poljih for(int i=0; i<6; i++) { rezultat = polje1[i] + polje2[i]; } cout<<"REZILTAT"<

how to display the result in reverse order
Why is resultat a short? You do store a sum of ints to it.

The loop on lines 26-30 could be replaced with `rezultat = polje1[5] + polje2[5];` because that is what you effectively do in it.

You don't use polje_vsot anywhere.

Reverse? How about `for (int i=5; 0<=i; --i)`. It's crude, but could suffice.
example.

1 2 result 3
2 3 5
3 11 14
4 1 5
5 1 6
6 12 18

result on display - 18 -6-5-14-5-3 (reverse order)
THIS IS RESULT.
 ``1234567891011121314151617181920212223242526272829303132333435363738394041424344454647`` `````` #include #include using namespace std; int main() { int polje1[6]; int polje2[6]; int polje_vsot[6]; int rezultat; cout<<"Vnesite elemente prvega polja: "<>polje1[i]; cout<<"Vnesite elemente drugega polja: "<>polje2[i]; //Sestevanje istoleÅ¾nih elementov v obeh poljih for(int i=0; i<6; i++) { rezultat= polje1[i] + polje2[i]; polje_vsot[i] = rezultat; } for(int i=6; 0

which field have a large sum?
how is code ?

Topic archived. No new replies allowed.