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

Write a program that accepts your first name into a character arraystring variab

ID: 3609257 • Letter: W

Question

Write a program that accepts your first name into a character arraystring variable. Print the name backwards.

#include<iostream>
#include<conio.h>
using namespace std;

int main()
{

   char firstName[8]={'S','h','a','n','n','o','n',''};
   cout<<firstName<<" ";

   system("pause");

}

i am stuck I can accept the name but I cannot print itbackwards

i know its something simple but i cannot remember what possibly afor loop but something with the array location or address isconfusing me

please help and i will award lifesaver points thx



Explanation / Answer

Here is a simpler solution you have no need for the second array ifall you want to do is print it. Also go ahead and rate the other guy higher, don't want to stealpoints form his perfectly legit answer. Array locations can be accessed by simple stating the array namefollowed by the [] with the location in the [] Also array's start from location 0 (not 1) and go to size -1, Inthis case Size-1 is the Null character so you must start fromSize-2 to get the last element in the array. #include #include using namespace std; int main() {     const int size = 8;     charfirstName[size]={'S','h','a','n','n','o','n', ''};     cout
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