#include <iostream>
#include <string>
#include <sstream>
#include <vector>
using namespace std;
int product();
vector<int> splitter();
vector<int> sequence();
int charToInt(char ch);
template <class T>
string toString(T num);
template <class T>
void printVector(const vector<T>& v);
template <typename T>
void vectorPrint(const vector<T> &list) {
for (T item : list) {
cout << item << " ";
}
}
// convert a char digit '0'..'9' to int
int charToInt(char ch) {
return ch - '0';
}
// Put your class here
class Numbas {
private:
int number{1};
public:
Numbas(int num){
if (num < 1) {
number = 1;
}
else{
number = num;
}
}
int getNumber(){
return number;
}
void setNumber(int x){
if (x < 0) {
number = 1;
}
else {
number = x;
}
}
vector<int> splitter(){
string strin = to_string(number); // this is where the exc error is being thrown
for (int i {0} ; i < strin.length(); i++) {
int conversion = charToInt(strin[i]);
if (conversion > 0){
splitter().push_back(conversion);
}
}
return splitter();
}
Any help with this is greatly appreciated ! Thanks