Array cout trouble

Im having trouble with my array. When I run the program it skips the first "enter your details" and goes straight to the next one. Anybody know what I have forgotten to do?

Thanks in advance.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include <cstdlib>
#include <iostream>

using namespace std;

typedef struct date{
        string day;
        string month;
        string year;
        }d;
        
typedef struct courseDetails{
        char courseId[10];
        char courseTitle[20];
        }c;
        
typedef struct student{
        char name[15];
        char studentNum[8];
        d dateReg;
        c courseDetails;
        } s;

void enterDetails (s*sArray, int size)
{
     for(int i=0; i < size; i++)
     {
     cout<<"Enter Student Number"<<endl;
     cin.getline(sArray[i].studentNum, 8+1);
     }
     }

int main(int argc, char *argv[])
{
    int size;
    cout<<"enter a size"<<endl;
    cin>>size;
    cout<<endl;
    
    s*sArray = new s[size];
    
    enterDetails;
    
    system("PAUSE");
    return EXIT_SUCCESS;
}
Line 42? Give it inputs arguments unless they will default to 0.
Thanks
Ok I am still having difficulties with this. I gave it the inputs but it still skips either the first or last input to the array when I run it? Is there something wrong with the loop?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#include <cstdlib>
#include <iostream>

using namespace std;

typedef struct date{
        int day;
        int month;
        int year;
        }d;
        
typedef struct courseDetails{
        char courseId[10];
        char courseTitle[20];
        }c;
        
typedef struct student{
        char name[15];
        char studentNum[8];
        d dateReg;
        c courseDetails;
        } s;

void enterDetails (s*, int);
void findStudent(s*, int);    

     
int main(int argc, char *argv[])
{
    int size;
    cout<<"enter a size"<<endl;
    cin>>size;
    cout<<endl;
    
    s*sArray = new s[size];
    
    enterDetails(sArray,size);
    
    findStudent(sArray,size); 
    
    
    
    system("PAUSE");
    return EXIT_SUCCESS;
}


void enterDetails (s*sArray, int size)
{
     for(int i=0; i < size; i++)
     {
     cout<<"Enter name"<<endl;
     cin.getline(sArray[i].name, 30+1); 
     cout<<"Enter Student Number"<<endl;
     cin.getline(sArray[i].studentNum, 8+1);
     cout<<"Enter day registered"<<endl;
     cin>>sArray[i].dateReg.day;
     cout<<"Enter month registered"<<endl;
     cin>>sArray[i].dateReg.month;
     cout<<"Enter year registered"<<endl;
     cin>>sArray[i].dateReg.year;
     cout<<"Enter course ID"<<endl;
     cin.getline(sArray[i].courseDetails.courseId, 15 + 1);
     
     }
     }


void findStudent(s*sArray, int size)
{
     char findName[30];
     cout<<"Enter a name to find"<<endl;
     cin.getline(findName, 30+1);
     int j = 0;
     while(strcmp(findName,sArray[j].name)!=0 && j<size)
     {
     j++;     
     }
     cout<<sArray[j].name<<endl;
     
     }
Topic archived. No new replies allowed.