Q:

Why can't I use a space in my array program?

If my input is a long name like "lsdhfjkhsdkjhfgkjhasd", then it is OK to print out. But if I use a space between a name like "fsdaf fdsaf dsaf ", then it does not show.
int main () {
    int total_hours;
    char name[100],category[140],nic[140];

    printf("Name:\n");
    scanf("%s",&name);

    printf("NIC:\n");
    scanf("%s",&nic);

    printf("category:\n");
    scanf("%s",&category);

    printf("Total Hours:\n");
    scanf("%d",&total_hours);
    printf("%s \n  %s \n  %s \n  %d \n ",name,nic,category,total_hours);
    getch();
}

A:

you need to use fgets, scanf ends on whitespace. and for C++ you should be using the higher level constructs. e.g. cin, cout
example 
fgets(name, 100, stdin);

answer
#include <stdio.h>
int main () {
int total_hours;
char name[100],category[140],nic[140];

printf("Name:\n");
fgets(name, 100, stdin);

printf("NIC:\n");
fgets(category, 140, stdin);

printf("category:\n");
fgets(nic, 140, stdin);

printf("Total Hours:\n");
scanf("%d", &total_hours);
printf("%s \n  %s \n  %s \n  %d \n ",name,nic,category,total_hours);
getch();
}

