Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

<p>Write a function thats called trimfrnt() that deletes all leading blanks from

ID: 3637416 • Letter: #

Question

<p>Write a function thats called trimfrnt() that deletes all leading blanks from a string. write this function using pointers with the return type void. The solution I come up with listed below, states I have an error in my programming?!? I&#8217;m having issues finding the error, please assist me, thanks&#8230;</p>
<p>&#160;</p>
<p>#include &lt;iostream&gt;</p>
<p>using namespace std;</p>
<p>void trimfrnt(char *strng);</p>
<p>int main()</p>
<p>{</p>
<p>int i = 0;</p>
<p>int len = 0;</p>
<p>len = strlen(strng);</p>
<p>i = len - 1;</p>
<p>while (*(strng + i) &amp;&amp; *(strng + i) == ' ')</p>
<p>i--;</p>
<p>len = i + 1;</p>
<p>*(strng + len) = '';</p>
<p>return;</p>
<p>}</p>

Explanation / Answer

#include using namespace std; void trimfrnt(char *strng); int main() { int i = 0; int len = 0; len = strlen(strng); i = len - 1; while (*(strng + i) && *(strng + i) == ' ') i--; len = i + 1; *(strng + len) = ''; return; }
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote