字数统计
来源:互联网 发布:sem搜索引擎优化案例 编辑:程序博客网 时间:2024/04/29 10:23
#include "OJ.h"#include <iostream>using namespace std;/*功能:对输入的整型数组,输出数组元素中的最大值、最大值的个数、最小值和最小值的个数 输入:int * pInputInteger:整型数组指针 int * InputNum:数组元素个数 输出:int * pMaxValue:数组中最大值 int * pMaxNum:数组中最大值的个数 int * pMinValue:数组中最小值 int * pMinNum:数组中最小值的个数 返回:void*/void OutputMaxAndMin(int * pInputInteger, int InputNum, int * pMaxValue, int * pMaxNum, int * pMinValue, int * pMinNum){/*在这里实现功能*/if (InputNum <= 0 || pInputInteger == NULL){*pMaxNum =0;*pMinNum = 0;*pMaxValue = 0;*pMinValue = 0;return ;} *pMaxNum =1;*pMinNum = 1;*pMaxValue = pInputInteger[0];*pMinValue = pInputInteger[0];for (int i =1; i < InputNum; ++i){if (pInputInteger[i] > *pMaxValue){*pMaxValue = pInputInteger[i];*pMaxNum = 1;}else if(pInputInteger[i] == *pMaxValue){(*pMaxNum)++;}if (pInputInteger[i] < *pMinValue){*pMinValue = pInputInteger[i];*pMinNum = 1;}else if(pInputInteger[i] == *pMinValue){(*pMinNum)++;}}return;}int main(){int aInputInteger[] = {1, 1,1,1,1,1,1};int iMaxValue, iMaxNum, iMinValue, iMinNum;OutputMaxAndMin(aInputInteger, 0, &iMaxValue, &iMaxNum, &iMinValue, &iMinNum);cout<<iMaxNum<<""<<iMaxValue<<endl;cout<<iMinNum<<""<<iMinValue<<endl;return 0;}
0 0
- 字数统计
- 字数统计
- 字数统计
- VBA 字数统计
- 字数统计-简单哈希表
- 统计文本字数
- 统计页面字数
- JS统计字数
- TextArea统计字数
- 字数统计器
- 微博 字数统计功能
- JavaScript 统计中文字数
- Fckeditor 字数统计
- textarea 字数统计
- 统计字数问题
- java统计汉字字数
- HDU 1735 - 字数统计
- UE字数统计
- HDUOJ 1754 I Hate It
- sublime text3 安装packages
- u-boot分析2
- HDUOJ 1698 Just a Hook
- 用popupwindow做一个spinner的坑记录
- 字数统计
- U-BOOT分析4
- matlab符号运算函数laplace的返回值
- nyoj 题目41:三个数从小到大排序
- 我的虚幻4之旅03 添加按键事件
- 创业第一步:为员工打工
- POJ 3468 A Simple Problem with Integers
- 12-14java面向对象之抽象类&接口
- OC语法<4.5> Foundation框架中-集合的内存管理和集合之间的相互转换