smemamian
جمعه 17 آذر 1391, 11:34 صبح
سلام دوستان
مشکل این کد چیه ؟
#include <cstdlib>
#include <iostream>
#define StudentsH
#define StudentsH
using namespace std;
class TStudent
{
public:
TStudent();
TStudent(string fn, string ln, int d, int m, int y);
~TStudent();
void setFirstName(string f) { FirstName = f; }
string getFirstName() { return FirstName; }
void setLastName(string l) { LastName = l; }
string getLastName() { return LastName; }
void setDayOfBirth(int d) { DayOfBirth = d; }
int getDayOfBirth() { return DayOfBirth; }
void setMonthOfBirth(int m) { MonthOfBirth = m; }
int getMonthOfBirth() { return MonthOfBirth; }
void setYearOfBirth(int y) { YearOfBirth = y; }
int getYearOfBirth() { return YearOfBirth; }
private:
string FirstName;
string LastName;
int DayOfBirth;
int MonthOfBirth;
int YearOfBirth;
};
int main(int argc, char *argv[])
{
string FN, LN;
int Day, Month, Year;
TStudent St;
cout << "Enter the student's information\n";
cout << "First Name: ";
cin >> FN;
cout << "Last Name: ";
cin >> LN;
cout << "Day of Birth: ";
cin >> Day;
cout << "Month of Birth: ";
cin >> Month;
cout << "Year of Birth: ";
cin >> Year;
St.setFirstName(FN);
St.setLastName(LN);
St.setDayOfBirth(Day);
St.setMonthOfBirth(Month);
St.setYearOfBirth(Year);
cout << "\nStudent Information";
cout << "\nFull Name: " << St.getFirstName()
<< " " << St.getLastName();
cout << "\nDate of Birth: " << St.getDayOfBirth()
<< "/" << St.getMonthOfBirth()
<< "/" << St.getYearOfBirth();
system("PAUSE");
return EXIT_SUCCESS;
}
مشکل این کد چیه ؟
#include <cstdlib>
#include <iostream>
#define StudentsH
#define StudentsH
using namespace std;
class TStudent
{
public:
TStudent();
TStudent(string fn, string ln, int d, int m, int y);
~TStudent();
void setFirstName(string f) { FirstName = f; }
string getFirstName() { return FirstName; }
void setLastName(string l) { LastName = l; }
string getLastName() { return LastName; }
void setDayOfBirth(int d) { DayOfBirth = d; }
int getDayOfBirth() { return DayOfBirth; }
void setMonthOfBirth(int m) { MonthOfBirth = m; }
int getMonthOfBirth() { return MonthOfBirth; }
void setYearOfBirth(int y) { YearOfBirth = y; }
int getYearOfBirth() { return YearOfBirth; }
private:
string FirstName;
string LastName;
int DayOfBirth;
int MonthOfBirth;
int YearOfBirth;
};
int main(int argc, char *argv[])
{
string FN, LN;
int Day, Month, Year;
TStudent St;
cout << "Enter the student's information\n";
cout << "First Name: ";
cin >> FN;
cout << "Last Name: ";
cin >> LN;
cout << "Day of Birth: ";
cin >> Day;
cout << "Month of Birth: ";
cin >> Month;
cout << "Year of Birth: ";
cin >> Year;
St.setFirstName(FN);
St.setLastName(LN);
St.setDayOfBirth(Day);
St.setMonthOfBirth(Month);
St.setYearOfBirth(Year);
cout << "\nStudent Information";
cout << "\nFull Name: " << St.getFirstName()
<< " " << St.getLastName();
cout << "\nDate of Birth: " << St.getDayOfBirth()
<< "/" << St.getMonthOfBirth()
<< "/" << St.getYearOfBirth();
system("PAUSE");
return EXIT_SUCCESS;
}