麻烦帮忙看看,以下这段代码是什么意思?

void f (Location p) 
{ cout <<"funtion:"<<p.GetX()<<","<<p.GetY()<<endl;}
Location g()
{Location c (2,3);
return c;
}

void main()
{Location A (1,2),B;
B=g();
f(a);
}

慕桂英4014372
浏览 482回答 1
1回答

至尊宝的传说

void f (Location p) //定义函数f{ cout <<"funtion:"<<p.GetX()<<","<<p.GetY()<<endl;} /*照英文的意思,应该输出Location中的数据成员x和y */Location g() //定义函数g{Location c (2,3);return c;}void main(){Location A (1,2),B; //定义两个location类型的变量B=g(); //调用g函数,这里B会等于g函数中的c变量f(a); //这里的a应改成大写的,则输出: funtion:1,2}
打开App,查看更多内容
随时随地看视频慕课网APP