下列表达式中正确的是()。
A: struct person{
int age;
char
name[8];
char sex;
}personl,person2;
B: struct person{
int
age;
char
name[8];
char sex;
} person
personl,person2;
C: struct person{
int
age;
char
name[8];
char sex;
};personl,person2;
D: struct person{
int
age;
chat
name[8]="WangLin";
char
sex="M";
} person1
A: struct person{
int age;
char
name[8];
char sex;
}personl,person2;
B: struct person{
int
age;
char
name[8];
char sex;
} person
personl,person2;
C: struct person{
int
age;
char
name[8];
char sex;
};personl,person2;
D: struct person{
int
age;
chat
name[8]="WangLin";
char
sex="M";
} person1
举一反三
- 对结构变量 person的出生年份进行赋值时,下列中正确的赋值语句是( )。[br][/br]struct date{int year;int month;int day};[br][/br]struct man[br][/br]{[br][/br]char name|20];[br][/br]char sex;[br][/br]struct date birthday;[br][/br]}person; A: year=1958; B: irthday.year=1958; C: person.birthday.year=1958; D: person.year=1958;
- 下列结构体中定义正确的是 A: record{<br/>int no;<br/>char num[16];<br/>float score;<br/>} B: struct record{<br/>int no;<br/>char num[16];<br/>float score;<br/>} C: struct record{<br/>int no;<br/>char num[16];<br/>float score;<br/>}; D: struct record{<br/>int no<br/>char num[16]<br/>float score<br/>};
- 一下选项中,定义结构体变量错误的是( ) A: struct student {int num; char name[30];<br> }wangming; B: struct {int num; char name[30];<br> }wangming; C: struct student {int num; char name[30];<br> }; struct student wangming; D: struct student {int num; char name[30];<br> }; student wangming;
- class Person { String name; int age; [br][/br] public Person(String name, int age) { super(); this.name = name; this.age = age; } @Override public boolean equals(Object obj) { Person person=null; if(obj instanceof Person) person=(Person)obj; if(name.equals(person.name)&&age==person.age) return true; return false; } } class Test{ public static void main(String[] args) { Person person1 = new Person("张三", 12); Person person2 = new Person("张三", 12); System.out.println(person1.equals(person2));//运行结果是? } } 程序运行结果是什么? A: true B: false
- 以下程序片断是否正确? #include "iostream.h" class Person { private: int m_nAge;[br][/br] public:[br][/br] int GetAge();[br][/br] };[br][/br] int Person:: GetAge() { return m_nAge; } void main()[br][/br] { Person person1; person1.m_nAge=10; cout<<person1.GetAge(); }