int array filling

Discussion in 'C Programming' started by MarsTeam, Oct 15, 2007.

  1. MarsTeam

    MarsTeam

    Joined:
    Oct 15, 2007
    Messages:
    1
    Hello, I am begginer in C++ and I have this problem:
    when you declare
    Code:
    char test[50];
    cout<<char[3];
    it will display 4th letter of that char, like I enter 'tester' it displays 'e'.

    Now I want to do same with int, but dont know how.
    I'd like to enter number like
    Code:
    int test[50];
    cout << test[3]
    and if we enter number 50123 it will display number 2 (4th member)
    test[0]=5
    test[1]=0
    test[2]=1
    test[3]=2
    test[4]=3

    I need to do math functions with it then so it wont work with char i think.

    can anyone help me how to do it ? Thanks in advance.
     
    MarsTeam, Oct 15, 2007
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Schnoffos
    Replies:
    2
    Views:
    1,223
    Martien Verbruggen
    Jun 27, 2003
  2. Hal Styli
    Replies:
    14
    Views:
    1,650
    Old Wolf
    Jan 20, 2004
  3. Alain Spineux
    Replies:
    6
    Views:
    634
    Eric Sosman
    May 17, 2011
  4. Mohsen Pahlevanzadeh
    Replies:
    0
    Views:
    121
    Mohsen Pahlevanzadeh
    Sep 9, 2013
  5. MRAB
    Replies:
    0
    Views:
    119
Loading...

Share This Page