Function isn't calling?
Why in the world is the function not calling?
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
|
#include <iostream>
#include <string>
using namespace std;
void readStudent( );
struct Student {
string firstName;
string lastName;
string aNumber;
int courses;
double gpa;
};
struct Course {
int courseNumber;
string courseName;
int creditHours;
char grade;
};
int main ( ) {
void readStudent();
system ("pause");
return 0;
}
void readStudent( ) {
Student student1;
Student *studenta;
studenta = &student1;
cout << "What is your first name?";
cin >> (*studenta).firstName;
cout << "What is your last name?";
cin >> (*studenta).lastName;
cout << "What is your A number?";
cin >> (*studenta).aNumber;
cout << "How many classes are you taking?";
cin >> (*studenta).courses;
}
|
Line 23, in main:
void readStudent();
Should be:
readStudent();
Oh dear. Perhaps I need more caffeine...thank you.
aha no worries. I make the simplest of mistakes. A good break always fixes them! (:
lol good stuff
Topic archived. No new replies allowed.