well now i have two problems:
1.) When I output 'account.expected_graduation_year,' I get a very square white box. I would assume this has to do with a casting problem, but I do not really know how to fix this and I do not know how to utilize streamstring like cyberfish said. Is there a way besides streamstring that just uses strings?
2.) When the user is inputting data (in this case, ME), I can enter in the name, number, and the year admitted, but then the program displays "Semester admitted to school" but doesn't let me input anything and goes straight to major...why is this?!
Code:
#include <iostream>
#include <string>
using namespace std;
struct StudentAccount
{
string name;
string major;
int admission_year;
int number;
string admission_semester;
string expected_graduation_year;
string expected_graduation_month;
};
int main()
{
StudentAccount account; //Accessing the member variables
cout << "Please enter the following information: " << endl;
cout << "Student Name: ";
getline(cin, account.name); //Receives the entire line
cout << "Student number: ";
cin >> account.number;
cout << "Year admitted to school: ";
cin >> account.admission_year;
cout << "Semester admitted to school: ";
getline(cin, account.admission_semester);
cout << "Major: ";
getline(cin, account.major);
account.expected_graduation_year = (account.admission_year + 4);
if (account.admission_semester == "Fall")
account.expected_graduation_month == "May";
else
account.expected_graduation_month == "December";
cout << "Your personal information: " << endl;
cout << "Student Name: " << account.name << endl;
cout << "Student Number: " << account.number << endl;
cout << "Major: " << account.major << endl;
cout << "Expected Graduation Year: " << account.expected_graduation_year;
cout << "Expected Graduation Month: " << account.expected_graduation_month;
}