a problem about C++

来源:百度知道 编辑:UC知道 时间:2024/09/25 12:15:46
#include <iostream>
void simon(int);
int main()
{
using namespace std;
simon (3);
cout<<"pick an integer:";
int count;
cin>>count;
simon (count);
cout<<"done!\n";
cout<<"\n";
return 0;
}
void simon(int n)
{
using namespace std;
cout<<"simon says touch your toes "<<n<<" times."<<endl;
}
请高手讲下个部分代码的作用
能详细点当然更好!

没什么特别的用途,运行后,首先输出“simon says touch your toes 3 times”(西蒙说摸你的脚趾头3次)。

之后要求输入一个整数(比如输入10),输入之后程序输出“simon says touch your toes 10 times”(西蒙说摸你的脚趾头10次)。

#include <iostream> //包含头文件
void simon(int); //声明函数
int main()
{
using namespace std; //使用命名空间std
simon (3); //调用simon()函数,参数是3
cout<<"pick an integer:"; //输出一个字符串
int count;
cin>>count; //输入count的值
simon (count); //调用simon(),参数是count
cout<<"done!\n"; //输出done!,并换行
cout<<"\n"; //再次换行
return 0;
}
void simon(int n)
{
using namespace std;
cout<<"simon says touch your toes "<<n<<" times."<<endl;
}

rtfm