On 2/15/07, muhammad shahid <[EMAIL PROTECTED]> wrote:
> HELLO TO ALL
> FRIENDS I AM A NEW PROGRAMMER IN C++, STUDENT OF
> ELECTRONICS AND TELECOM ENGG.
> MY problem(in the following program) is that i
> want to store the values of 1starray(int 1starray[15]) into the
> 2ndarray(2ndarray[15]) in the reverse order
> i.e., the value at " 1starray[0]" will be equal to at "2ndarray[15]" in
> other words values at reverse index of array.
Think about the problem for a bit. Try to take a paper and pencil and
draw the two arrays. Observe the relation between the two array's
indices. Hopefully you'll see the logic.
> i am using turbo c 3.0.
Don't. Better use some modern compiler that supports the current
standards, like GCC or Microsoft's VC2005.
> #include<iostream.h>
Non-standard (pre-standard) header. This won't be available on newer
compilers. The proper one to use is <iostream> (that puts everything
in namespace std).
> #include<conio.h>
Non-standard header again. Since you're only using it for clrscr,
better drop it completely.
> void main()
main should return an int to the OS.
> {
> clrscr();
A non-standard function, that serves no real purpose. Most people are
annoyed by programs that clear the console when they run.
> int 1starray[15];
> int 2ndarray[15];
This won't even compile, since variable names cannot start with a number.
> cout<<""Enter values?\n";
Instead of '\n' you should use std::endl.
> for(int i=0;i<15;i++)
> {
> cin>>1starray[i];
> }
> HOW I DO NEXT \
Take my advice and try to do it by hand first. Then try to interpret
what you did into code. Shouldn't be that hard, and surely you'll
learn from that experience a lot more than from copying someone's
solution and claiming it your own. If you run into problems, post what
you have so far (copy-paste, not retyping!).
--
Tamas Marki