mirror of
https://github.com/Estom/notes.git
synced 2026-04-01 01:50:32 +08:00
32 lines
613 B
C++
32 lines
613 B
C++
#include <iostream>
|
|
#include <vector>
|
|
using namespace std;
|
|
|
|
int hello(int a, int b)
|
|
{
|
|
cout << a << b << endl;
|
|
return 0;
|
|
}
|
|
|
|
//多个形参列表,必须是相同类型。
|
|
//另外把这个东西换成vector也是没有问题的。
|
|
//但是这个东西C++默认提供的类型,不需要头文件。
|
|
int multi_value(initializer_list<int> lst)
|
|
{
|
|
auto begin = lst.begin();
|
|
auto last = lst.end();
|
|
while (begin != last)
|
|
{
|
|
cout << *begin << endl;
|
|
begin++;
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
int main()
|
|
{
|
|
int i = 0;
|
|
// hello(i+1,i=i+1);
|
|
multi_value({1, 2, 3, 5});
|
|
return 0;
|
|
} |