编写函数,使其在第一次调用时返回 0,然后再次调用时按顺序产生正整数(即 返回其当前的调用次数)。

int count_return( )
{
	static int counts = 0;
	return counts++;
}

int main( int argc, char **argv ) //argc用于传递argv中字符串的个数, argv是一个C风格字符串数组
{
	for( int i = 0; i < 10; i++ )
	{
		cout << count_return();
	}
	
	return 0;
}


posted @ 2013-04-02 22:28  坚固66  阅读(230)  评论(0编辑  收藏  举报