c语言find函数的用法详解


当前第2页 返回上一页

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

#include <iostream>

#include <vector>

#include <algorithm>//注意要包含该头文件

using namespace std;

int main()

{

    int nums[] = { 3, 1, 4, 1, 5, 9 };

    int num_to_find = 5;

    int start = 0;

    int end = 5;

    int* result = find( nums + start, nums + end, num_to_find );

    if( result == nums + end )

    {

        cout<< "Did not find any number matching " << num_to_find << endl;

    }

    else

    {

         cout<< "Found a matching number: " << *result << endl;

    }

    return 0;

}

推荐学习:c语言视频教程

以上就是c语言find函数的用法详解的详细内容!

返回前面的内容

相关阅读 >>

C语言中,一条简单语句的结束符为什么?

C语言怎么删除字符串中相同字符

C语言中什么是转义字符

C语言strcpy函数用法

C语言程序中的基本功能模块为什么?

C语言指数怎么表示

C语言中用于实现循环结构的三种基本语句是什么

学习C语言需要什么软件?

C语言函数如何声明

运行C语言有哪些软件

更多相关阅读请进入《C语言》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...