What is wrong with this program code? I need help.
using namespace std;
int main () {
string g;
int count;
cout << "Enter a num\n";
cin >> g;
count = g.size() - 1; // length of number - 1
cout << g[0] << " is " << count << " digits from the right";
return 0;
You haven't #include
d the iostream and string headers, and you're missing a } at the end of your code.
Yeah, basically above where you have written using namespace std
write #include <iostream>
and #include <string>
correct me if I'm wrong but "count" simbol belongs to std namespace so you can't use that name for varialble.