Q:

input is not working in C++

//
//  main.cpp
//  FirstProgram
//
//  Created by Sajal Arora on 23/01/14.
//  Copyright (c) 2014 Sajal Arora. All rights reserved.
//

#include <iostream>
using namespace std;
int main(int argc, const char * argv[])
{
    int id;
    string name;
    // insert code here...
    cout << "Name :- ";
    std::cin >> name;
    cout << "Employee id :- ";
    cin >> id;
    cout << "Absent days:- ";
    void absent_days();
    return 0;
}
void absent_days() {
    int a[5];
    for (int i=0; i<5; i++) {
        cin >> a[i];
    }
    for (int i=0; i<5; i++) {
        for (int j=0; j<5-i; j++) {
            if (a[i]>a[j]) {
                int temp=a[i];
                a[i]=a[j];
                a[j]=temp;
            }
        }
    }
    cout << "Sort by Ascending order";
    for (int i=0; i<5; i++) {
        cout << a[i] <<" /t";
    }

} 

I run the above program in Xcode.And when i input, input is not working the output of above program is:-
Name :- Sajal 
Employee id :- 3 
Absent days:- Program ended with exit code: 0
why my code is not able to input arrays?

A:

You need two or three things to do to make it work:

change 
void absent_days();

to
absent_days();

to make it as a function call instead of a function declaration.
put the function declaration before the main body, i.e. you have to declare it before using it.
void absent_days();
int main(int argc, const char * argv[])
{
    // ...
}

[optional] if you still have compiler error in line cin >> name; (for me, yes), you also need to include string header:
#include <string>

