- 5
- 0
- 约1.13万字
- 约 17页
- 2016-11-24 发布于贵州
- 举报
C程序设计第六章案
实验六 数组
练习6.2
代码如下:
#include iostream
using namespace std;
int main()
{
int num, max = 0, count = 1;
//user input 6 numbers
for (int i = 0; i 6; i++)
{
cout Enter a number: ;
cin num;
//if number entered max, max = num, count = 1 again.
if (num max)
{
max = num;
count = 1;
}
else if (num == max)
{
count++;
}
}
//display
cout The largest number is max endl;
cout The largest number appears count times\n;
return 0;
}
练习6.4
代码如下:
#include iostream
using namespace std;
int main ()
{
int score[40];
int upcount = 0, downcount = 0, equ
原创力文档

文档评论(0)