DEV Community

Cover image for name input = multi digit number = digit plus digit <= 9 = answer
William Brock
William Brock

Posted on

name input = multi digit number = digit plus digit <= 9 = answer

im lost, first half works second part i have no idea disambiguos parenthesis and expected declaration errors

include < iostream>

include < cctype>

include < string>

using namespace std;

int main()
{
cout << "Present Name." << endl;
string named {};
getline(cin, named);
int sum{};
for (auto& key : named)
{
if(isalpha(key))
{
key = toupper(key);
sum += static_cast(key - 'A' + 1);
int second()
{
int num = 0;
while(1)
{
int num;
num += (sum % 10);
sum /= 10;
if(0 == sum)
{
if(num > 9)
{
sum = num;
num = 0;
}
else
{
cout << num << endl;
system("pause");
return 0;
}
}
};
}
}
}
}

Top comments (0)