第2个回答 2019-05-05
vc++
6.0的程序如下,如果在.net下运行,头文件需要改动,并加上域名的说明语句;
#include<iostream.h>
void
main()
{
int
n,i,num,total;
n=num=total=0;
float
ave;
cout<<"enter
the
number
of
numbernal:
"<<endl;
cin>>n;
for(i=0;i<n;i++)
{
cout<<"enter
the
numbernal:
"<<endl;
cin>>num;
total=total+num;
}
ave=total/n;
cout<<"the
average
of
numbernal
is:
"<<ave<<endl;
}