首页 > > 详细

辅导留学生C Student设计、Student C调试、辅导留学生C程序

#define _CRT_SECURE_NO_DEPRECATE
#include
#include
#include
struct Student
{
char* Name;
char* Number;
char* Phone;
char Sex;
int BirthYear;
char* SexStr;
void init(char* name, char* number, char* phone, int sex, int birthYear)
{
Name = name;
Number = number;
Phone = phone;
Sex = sex;
BirthYear = birthYear;
SexStr = (char*)malloc(2 * sizeof(char));
switch (sex)
{
case 0:
sprintf(SexStr, "?); break;
case 1:
sprintf(SexStr, "?); break;
}
printf("Base address = %0.8X\n", this);
printf("€tudent%d\n", sizeof(Student));
}
int getAge()
{
time_t timep;
tm *p;
time(timep);
p = gmtime(timep); //ゅtm
int Year = 1900 + p->tm_year;
return Year - BirthYear;
}
void introduce()
{
printf("у%s,%s,%d€%s?s\n", Name, SexStr, getAge(), Number, Phone);
}
};
void main()
{
Student student;
student.init("?, "2017174", "13760855621", 0, 1988);
student.introduce();
system("pause");
}
 

联系我们
  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp
热点标签

联系我们 - QQ: 99515681 微信:codinghelp
程序辅导网!