Quisiera encontrar el error o lo que le falta a mi código para que compile exitosamente.
#include <iostream>
#include <string>
using namespace std;
class Student
{
public:
string firstName, lastName;
int dob;
int phoneNumber;
int id;
double overallGPA;
};
int main()
{
Student Student1;
cout << "\t Student 1 Info:" << endl;
cout << "Student 1 ID: ";
Student1.id = 444444444;
cout << "Student 1 Phone Number: ";
Student1.phoneNumber = {828, 888, 8888};
cout << "Student 1 Date Of Birth: ";
Student1.dob = {11, 21, 1985};
cout << "Student 1 Overall GPA: ";
Student1.overallGPA = 3.45;
cout << "Student 1 First Letter of Last Name: ";
Student1.firstName = "T";
cout << "Student 1 First Letter of First Name: ";
Student1.lastName = "R";
return 0;
}
En las lineas Student1.dobStudent1.dob
y Student1.phoneNumberStudent1.phoneNumber
son un arreglo, pero no se como manejarlo con las clases.
Me sale el siguiente error en el terminal:
preLab.cpp:30:25: error: expected expression
Student1.phoneNumber = {828, 888, 8888};
^
preLab.cpp:33:17: error: expected expression
Student1.dob = {11, 21, 1985};
^
2 errors generated.