首页 > 试题广场 >

阅读下列程序,写出运行结果: #include usi

[问答题]
阅读下列程序,写出运行结果:
#include <iostream>
using namespace std;
struct Employee
 {
char name[ 20 ];
   char sex;
 };
void fun( Employee *p )
{
if( (*p).sex == 'm' )
     cout << (*p).name << endl;
}
int main()
{
Employee emp[5] = { "Liming", 'm', "Wangxiaoping", 'f', "Luwei", 'm' };
  int i;
  for( i=0; i<3; i++ )
    fun( emp+i );
}

推荐
Liming

Luwei


发表于 2018-05-07 11:50:30 回复(0)