VS пишет что не может инициализировать ссылки (&char, &string) и подчеркивает fun(s1[1], s1);
#include <array>
#include <iostream>
#include <algorithm>
#include <climits>
#include <map>
#include <vector>
#include <set>
#include <string>
#include <cstdlib>
using namespace std;
void display(int n)
{
cout << n << ' ';
}
typedef unsigned long long ull;
typedef string _type;
typedef vector<_type> v_t;
typedef vector<vector<_type>> v2_t;
typedef vector<pair<_type, _type>> v_p;
typedef vector<bool> v_b;
v2_t vs(9);
array <char, 1> a0 = { '8' };
array <char, 5> a1 = { '0', '3', '4', '7', '8' };
array <char, 1> a2 = { '8' };
array <char, 2> a3 = { '8', '9' };
array <char, 2> a4 = { '8', '9' };
array <char, 3> a5 = { '6', '8', '9' };
array <char, 1> a6 = { '8' };
array <char, 4> a7 = { '0', '3', '8', '9' };
//array <char, 0> a8;
array <char, 1> a9 = { '8' };
int check(int n)
{
int k(1);
for (auto &v1 : vs)
for(auto &s1 : v1)
if (atoi(s1.c_str()) <= n)
++k;
return k;
}
void fun(char &ch, string &s)
{
char old = ch;
switch (ch)
{
case '0':
for (auto ch1 : a0)
{
ch = ch1;
vs[0].emplace_back(s);
}
ch = old;
break;
case '1':
for (auto ch1 : a1)
{
ch = ch1;
vs[1].emplace_back(s);
}
ch = old;
break;
case '2':
for (auto ch1 : a2)
{
ch = ch1;
vs[2].emplace_back(s);
}
ch = old;
break;
case '3':
for (auto ch1 : a3)
{
ch = ch1;
vs[3].emplace_back(s);
}
ch = old;
break;
case '4':
for (auto ch1 : a4)
{
ch = ch1;
vs[4].emplace_back(s);
}
ch = old;
break;
case '5':
for (auto ch1 : a5)
{
ch = ch1;
vs[5].emplace_back(s);
}
ch = old;
break;
case '6':
for (auto ch1 : a6)
{
ch = ch1;
vs[6].emplace_back(s);
}
ch = old;
break;
case '7':
for (auto ch1 : a7)
{
ch = ch1;
vs[7].emplace_back(s);
}
ch = old;
break;
case '9':
for (auto ch1 : a9)
{
ch = ch1;
vs[9].emplace_back(s);
}
ch = old;
break;
default:
break;
}
}
int main()
{
int n, sum;
cin >> n;
string s;
cin >> s;
fun(s[0], s);
for (auto &s1 : vs)
fun(s1[1], s1);
cout << check(n);
system("pause");
return 0;
}
Современные инструменты для криптотрейдинга: как технологии помогают принимать решения
Апостиль в Лос-Анджелесе без лишних нервов и бумажной волокиты
Основные этапы разработки сайта для стоматологической клиники
Продвижение своими сайтами как стратегия роста и независимости