Thread: HELP! im looking for different ways .

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Apr 2002
    Posts
    9

    Exclamation HELP! im looking for different ways .

    Im looking for ways to use arrays using pointers.
    an ex is:
    #include<iostream.h>
    #include<conio.h>
    void main ()
    {
    int sales[7]= {1,2,3,4,5,6,7}
    int*p=&sales[0];
    int x;
    //-----------------------------
    for(x=0; x<7; ++x)
    cout<<"$"<<sales[x]<<" ";
    cout<<endl;
    //-----------------------------
    for(x=0; x<7; ++x)
    cout<<"$"<<p[x]<<" ";
    cout<<endl;
    //-----------------------------
    for(x=0; x<7; ++x)
    cout<<"$"<<*(sales+x<<" ";
    cout<<endl;
    //-----------------------------
    for(x=0; x<7; ++x)
    cout<<"$"<<*(p+x)<< " ";
    cout<<endl;
    getch();
    }

    \\ all of the above give the same result
    \\$1 $2 $3 $4 $5 $6 $7

    any more ways???????
    at least I need 10 more ways

    any feed back is greatly accepted
    Last edited by moenia; 04-29-2002 at 01:11 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. any smarter ways to design this tree structure
    By George2 in forum C++ Programming
    Replies: 5
    Last Post: 04-19-2008, 07:34 AM
  2. Smarter ways to define MACRO to strings?
    By George2 in forum C Programming
    Replies: 1
    Last Post: 11-22-2007, 02:05 AM
  3. Best ways to learn
    By MartijnG in forum C++ Programming
    Replies: 15
    Last Post: 08-29-2006, 10:51 AM
  4. Three ways to get creation date of a file?!
    By maxhavoc in forum Windows Programming
    Replies: 1
    Last Post: 01-08-2005, 02:16 PM
  5. Easy painless ways to code
    By VirtualAce in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 12-31-2003, 10:44 PM