Hi, I am to create two function that will sum the ASCII values in a string. The first ASCII function solves the first string and the second ASCII function solves two strings. I just need to add the first and second string with the second function without duplicating the code. Any suggestions or hints will be appreciated.
Here's my code:
#include <iostream>
#include <string>
using namespace std;
int sumAscii(string &seqStr);
int sumAscii(string &seqStr, string &seqString);
Thanks gunner for the input but that's way too advance for me.
Thanks thomas! That's what I'm looking for. I don't know why I didn't think of that. It's as simple as returning a + b.
should not compile since the one-argument version of sumAscii takes a non-const reference and the temporary produced by the expression seqStr+seqString should not bind to a non-const reference.
What would compile (and avoid unnecessary copies) is: