hi all pretty new to programming here
the idea of the code is for the function to take in an string and an int and to pad the string with space on the left with the int being the number of space to put in.
am i doing something wrong?
#include <iostream>
#include <string>
using namespace std;
string padBlanks(string, int);
int main()
{
string string1;
int padN;
cout<< "Please enter a string";
cin>> string1;
cout<< "Please enter a number";
cin >> padN;
padBlanks(string1, padN);
cin.ignore();
cin.ignore();
}
string padBlanks(string string1, int padN)
{
string blank(padN,' ');
cout<< blank <<string1;
return 0;
}
i keep getting the error Expression invalid null pointer
"The program '[3180] test.exe: Native' has exited with code 3 (0x3)."
thanks for the help!